cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Condition displays "The input array was empty." and does not execute true path

Basically, I'm trying to retrieve a Contact record from Dynamics CRM. If the record is null/false, I want to do something. If the record is found/true, I want to do something else. Right now, if the CRM record is null, the Flow seems to end with the "The input array was empty" message. If the record is found, it executes the false branch of the condition.  

 

Flows_question2.PNG

Here is my condition.

 

Flows_question4.PNG

 

Here are some of the statements I've tried.

 

@empty(body('List_records'))

@greater(length(outputs('List_records')),0)

 

Seems like something that should be extremely easily to handle. Does anyone know how to get this to work?

 

Thanks! Any help is much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Condition displays "The input array was empty." and does not execute true path

@faustocapellanj This statement works! @if(empty(body('List_records')?['value']),True,False)

 

Thanks for your help working through this. Removing the "Apply to each" step was part of the process.

View solution in original post

9 REPLIES 9
Highlighted
Solution Sage
Solution Sage

Re: Condition displays "The input array was empty." and does not execute true path

Hi @dumber_texan2,

 

Can you try the expression below in the Condition? You can either do 1=true or 0=false.

@equals(length(outputs('List_records')),0)

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Highlighted
Frequent Visitor

Re: Condition displays "The input array was empty." and does not execute true path

@faustocapellanj Thanks for the help. I tried that. Here is the error message.

 

InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '1580': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#length for usage details.'.

 

Based on this comment "You can either do 1=true or 0=false" I'm concerned that Microsoft Flows doesn't have a true or false option for my use case. Is this correct?

 

Basically, I'm looking for something like this.

 

if ('List_records' = null)

{

 //Do this.

}

else

{

 //Do this other thing.

}

 

Thanks!

Highlighted
Solution Sage
Solution Sage

Re: Condition displays "The input array was empty." and does not execute true path

Hi @dumber_texan2,

 

Move the condition outside the Apply to each step and do the same expression I suggested, but do the 1 instead of the 0 so it can return true. Once you do that, then the Apply to each step will be added automatically to the Yes or No step. Let me know how that goes.

 

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Highlighted
Frequent Visitor

Re: Condition displays "The input array was empty." and does not execute true path

@faustocapellanj Thank for your continued support on this. Everything now evalutaes as false. I can't get a true result. "The input array was empty" message has gone away. Any other ideas? I can't believe this isn't more straightforward.

Highlighted
Solution Sage
Solution Sage

Re: Condition displays "The input array was empty." and does not execute true path

What's the Output on the List records step? Can you please post a screenshot of that output? You can see what comes back from the query, which will give you an idea on how to build the expression for the condition. Please let me know what you get.

Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Highlighted
Frequent Visitor

Re: Condition displays "The input array was empty." and does not execute true path

@faustocapellanj This statement works! @if(empty(body('List_records')?['value']),True,False)

 

Thanks for your help working through this. Removing the "Apply to each" step was part of the process.

View solution in original post

Highlighted
Solution Sage
Solution Sage

Re: Condition displays "The input array was empty." and does not execute true path

That's awesome. I'm glad that it works.

Regards,.
Fausto Capellan, Jr

Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Highlighted
Frequent Visitor

Re: Condition displays "The input array was empty." and does not execute true path

I'm having this same issue. I tried the solution but I'm getting an error. Are you able to post an image of the solution?

Highlighted
Frequent Visitor

Re: Condition displays "The input array was empty." and does not execute true path

Basically, I'm doing a lookup in "List reocrds". Since I don't know if "List records" is going to find anything, then I have the condition.

 

@if(empty(body('List_records')?['value']),True,False)

 

If "List records" finds a record, then the above condition evaluates as False. If "List records" doesn't find a record, the above condition evaluates as True.

 

If False, then it hits the False branch. If true, then it hits the True branch.

 

Hope this helps. For some reason, I can't post an image.

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (6,286)