user6260854
user6260854

Reputation: 3

azure logic app skip condition not working

I have created a logic app that makes use of an execute stored procedure action.

It returns an array to iterate the data and pass it on to a service bus connector.

I have a condition to skip the service bus connector action execution if the stored procedure returns null. However, instead of being skipped the service bus connector throws an error stating null cannot be iterated.

I checked the condition using dummy values, and have confirmed that it works, but when null is encountered it's throwing error.

Upvotes: 0

Views: 1692

Answers (1)

Szymon Wylezol
Szymon Wylezol

Reputation: 1466

Can you confirm that the stored procedure actually returns an empty array if there are no elements? It seems that in this case it does not return any value (i.e. null)

Keep in mind that you can use the safe dereference operator that allows you to reference null properties of an object without a runtime error. You can also use the coalesce function that returns the first non-null object in the arguments passed in. For example, if you use this expression to handle a null action outputs:

@coalesce(action('myAction').outputs?.body?.arrayProperty, json('[]'))

Upvotes: 1

Related Questions