Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to handle null value in logic app condition module

I have a logic app where i use a condition expression on to two variables, displayName and accountName.

Sometimes a variable will not exist. which will cause this error:

InvalidTemplate
Unable to process template language expressions for action 'Condition' at line '0' and column '0': '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 do i handle this error? I want the condition to treat the null value as if the variable is a empty string

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

Is it possible to write a expression thats like iff(accountName is empty(), ”, accountname)?

>Solution :

You can do so by using coalesce() function.

I am using below given expressions to achieve this.

coalesce(variables('accountName'),'')
coalesce(variables('displayName'),'')

enter image description here

This works if one variable is not exist. Here I am only passing the value of account name but not display name.

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading