question

BasvanZon-7304 avatar image
0 Votes"
BasvanZon-7304 asked ·

How to deal with possible null values in Control conditions in Azure Logic App

Hi,

I have a question about Control in Azure App Logic evaluating conditions where @(body) can in some cases be Null.

See the image for context.
The conditions in my Control do checks on responses from Azure functions.

Because I am implementing a finite state machine, sometimes, some of the Azure Functions do not execute.
The logic app fails because it tries to evaluate a condition on a @(body) that was Null.

The error I get is:
"
InvalidTemplate. Unable to process template language expressions for action 'Condition_-Check_for'Error'' at line '1'
and column '3141': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary
(object), an array or a string. The provided value is of type 'Null'.'.
"

How can I deal with potential null values in Control?

11843-applogic-1.png



azure-logic-apps
applogic-1.png (39.7 KiB)
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Great! Thank you!

0 Votes 0 · ·

1 Answer

SathyamoorthyVijayakumar-MSFT avatar image
0 Votes"
SathyamoorthyVijayakumar-MSFT answered ·

Hello @BasvanZon-7304,


You can avoid this situation by checking whether the function is returning null. You can add a condition to check the function response. 11949-ci002.png



Alternatively,


You could leave the comparison text as blank to compare it with null like below.


11927-ci004.png


With the above condition in place you can filter off the null responses and work with the non-null responses.





ci002.png (85.4 KiB)
ci004.png (24.0 KiB)
· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you!

0 Votes 0 · ·