To set trigger conditions using logic app designer, follow the steps below:
1- Go to your logic app.
2- On the trigger, click on the three dots (...) at the top right corner.
3- Select Settings.
4- Scroll down to Trigger Conditions.
5- Specify your conditional expression.
You can set single or multiple conditions as follows:
In this example, we apply trigger filter @not(equals(triggerBody().Size,0)) on the When a blob is added or modified (properties only) trigger settings under Trigger Conditions, so that the logic app is not triggered with empty files.
You can define multiple conditions but the logic app will only fire if all conditions are met.
Two or more AND conditions
@not(empty(triggerBody())) and @contains(triggerBody()?['Name'],'.txt')
This trigger will only fire if the trigger body is not empty and the file is a text file by checking if the name property contains '.txt' extension inside the trigger body.
If you apply it on a trigger with Split On enabled, the conditions are evaluated after the splitting which guarantees that only the array
elements that match the conditions are fired.
In this case, you will see one trigger event for each element in the trigger history, triggers that did not fire due to trigger conditions will be found in Trigger History.
Simple logic app with less steps by moving logic that would usually be inside the logic app to define if the logic app can be executed or not to inside the trigger itself.
Clean workflow run history that reduces operational burden by eliminating unwanted runs.
Reduced costs by reducing the action calls made for checking the conditions within logic app.
Trigger conditions are not visible which make it hard to troubleshoot; so, it is recommended to modify trigger name to indicate that there are trigger conditions set.
Adding trigger conditions does not support intellisense; so, it is recommended to draft your expression within an initialize variable or compose action, note that in these actions, an @ is not needed at the beginning of the expression, but within trigger conditions it is needed
Runs that did not meet the trigger conditions will not show in the runs history.