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

Bas van Zon 26 Reputation points
2020-07-10T09:28:58.837+00:00

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
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,211 questions
{count} vote

Accepted answer
  1. svijay-MSFT 5,236 Reputation points Microsoft Employee
    2020-07-13T09:32:28.843+00:00

    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.

    5 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.