cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JoeVolk
Level: Powered On

Run flow only if fields have values

I have a Flow that I want to run when an item is modified but only if 2 fields have values as they are important pieces that need to be included when a task is assigned to users. What I have in place now that isn't working is a condition that evaluates the two fields but that throws an error. Here is my formula: 

and(equals(triggerBody()?['ProductFamily']?['Value'], ''), equals(triggerBody()?['Customers']?['Value'], '')). 
 
The error I receive is this: 
InvalidTemplate. Unable to process template language expressions for action 'Condition_2' at line '1' and column '2494': 'The template language expression 'equals(and(equals(triggerBody()?['ProductFamily']?['Value'], ''), equals(triggerBody()?['Customers']?['Value'], '')), True)' cannot be evaluated because property 'Value' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.
 
Any ideas?
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Run flow only if fields have values

Hi @JoeVolk,

 

Does the ProductFamily and the Customers field are both choice type column allow multiple selections?

 

I have made a test on my side, if the ProductFamily and the Customers field are both choice type column allow multiple selections, you couldn't get the single value from the ProductFamily array value and the Customers array value.

 

You could take a try to compare the length of the ProductFamily array or the Customers array with 0 to see if the ProductFamily array or the Customers array is null.

 

The screenshot of the flow should as below:

Capture.PNG

 

The expression in the Condition as below:

@and(equals(length(triggerBody()?['ProductFamily']), 0), equals(length(triggerBody()?['Customers']), 0))

When an item is created and the ProductFamily and the Customers field are both null, the flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Run flow only if fields have values

Hi @JoeVolk,

 

Does the ProductFamily and the Customers field are both choice type column allow multiple selections?

 

I have made a test on my side, if the ProductFamily and the Customers field are both choice type column allow multiple selections, you couldn't get the single value from the ProductFamily array value and the Customers array value.

 

You could take a try to compare the length of the ProductFamily array or the Customers array with 0 to see if the ProductFamily array or the Customers array is null.

 

The screenshot of the flow should as below:

Capture.PNG

 

The expression in the Condition as below:

@and(equals(length(triggerBody()?['ProductFamily']), 0), equals(length(triggerBody()?['Customers']), 0))

When an item is created and the ProductFamily and the Customers field are both null, the flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

View solution in original post

Helpful resources

Announcements
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!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,146)