I'm setting up an Azure Logic Apps Workflow with a trigger, but am currently unable to define default values for such trigger's fields in the JSON Schema.

I have enabled JSON Schema validation and Required fields as described here: https://www.danrigby.com/2018/08/27/enable-schema-validation-and-required-fields-in-logicapps/

My JSON Schema currently looks as follows:

{
    "anyOf": [
        {
            "required": [
                "delay"
            ]
        },
        {
            "required": [
                "startTime"
            ]
        }
    ],
    "properties": {
        "callbackUrl": {
            "type": "string"
        },
        "delay": {
            "default": 0,
            "minimum": 0,
            "type": "integer"
        },
        "startTime": {
            "type": "string"
        }
    },
    "required": [
        "callbackUrl"
    ],
    "type": "object"
}

I've also tried replacing default with defaultValue but without luck.

I expected delay to be populated as 0 when absent, instead it is interpreted as null within Azure Logic Apps Workflow, causing the failure of following boolean conditions such as delay is greater than 0 because they don't expect null values to get evaluated.

1 Answers

0
PramodValavala-MSFT On Best Solutions

I believe the JSON Schema is just used for validation here, as it is in many scenarios. The default property is ignored by many implementations as mentioned in the official docs.

Instead, you can use this expression where you need the default value on null

if (equals(triggerBody()?['delay'], null), triggerBody()?['delay'], 0)