cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ck25415
Post Patron
Post Patron

Identify which condition failed in a condition control

Hello,

 

I have condition control block wtih multiple condition inputs(10) in it, is there a way to identify which condition failed in the condition control. I would like to log the failed condition in a comments field of the Sharepoint list item.

 

Is there a way to do it other than splitting the condtion block into 10 different condition actions and appending the failed condition into a variable at the failed instances and updating it into sharepoint item in the last step.

 

Please let me know.

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ck25415,

 

Cause you have 10 conditions to fitter the items in your SharePoint and you want to identify which condition was failed after a run, right? Maybe you could make a workaround that uses the Compose action to put each condition into it. 

For example, you can use the expression:

if(equals(item()?['title'],'test'),true,false)

it has the same function as the condition Title is equal to 'test'.

Annotation 2019-08-26 125833.png

So, you can create a branch to put the ten condition into these Compose action.

Annotation 2019-08-28 143450.png

 

About greater, less, and, etc logical comparison functions, you can have a reference to this document:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#l...

 

Hope it can help you.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
RezaDorrani
Dual Super User II
Dual Super User II

Hi @ck25415 

 

You would have to set configure run after for all your condition block actions (parallel branch)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

@RezaDorrani 

 

Do you mean split my block of conditions into multiple conditions(parallel branched) and use configure run after to log failed actions?

 

Do you think logging all failed conditions with a descriptive message (something like condition "name" failed: "value") about each failed action is possible with this design? I am thinking of appending the custom message into a string variable in the "No case" of all the parallel conditions and use it later to log. I am not sure if its a good idea to use the same string variable to append in parallel branching... should I be using different variables for all the conditions?

 

Please comment.

RezaDorrani
Dual Super User II
Dual Super User II

Hi @ck25415 

 

You can even mix it up with scopes (this is error handling)

https://veenstra.me.uk/2018/06/06/microsoft-flow-advanced-error-handling-throw-in-flow/

 

Now reading your post again looks like you have a condition block that has multiple conditions and finally evaluates to true or false

and you want to know which block evaluated to false

Then  if your condition is false, you can add individuals conditions after that to check each condition and see which one evaluated to false to log in to list item

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi @ck25415,

 

Cause you have 10 conditions to fitter the items in your SharePoint and you want to identify which condition was failed after a run, right? Maybe you could make a workaround that uses the Compose action to put each condition into it. 

For example, you can use the expression:

if(equals(item()?['title'],'test'),true,false)

it has the same function as the condition Title is equal to 'test'.

Annotation 2019-08-26 125833.png

So, you can create a branch to put the ten condition into these Compose action.

Annotation 2019-08-28 143450.png

 

About greater, less, and, etc logical comparison functions, you can have a reference to this document:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#l...

 

Hope it can help you.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@RezaDorrani @v-litu-msft Thank you for the suggestions.


@v-litu-msft wrote:

Hi @ck25415,

 

Cause you have 10 conditions to fitter the items in your SharePoint and you want to identify which condition was failed after a run, right? Maybe you could make a workaround that uses the Compose action to put each condition into it. 

For example, you can use the expression:

if(equals(item()?['title'],'test'),true,false)

it has the same function as the condition Title is equal to 'test'.

Annotation 2019-08-26 125833.png

So, you can create a branch to put the ten condition into these Compose action. Annotation 2019-08-26 130625.png

About greater, less, and, etc logical comparison functions, you can have a reference to this document:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#l...

 

Hope it can help you.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


 

Hi @ck25415,

 

Have you solved your problem?

I find another way to identify which condition failed, so I want to update it for you.

In the SharePoint have a type of column named Calculated, it will according to the condition of a statement and return a Yes or No value. You can have a reference to this document: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/bb862071(v%3Doff...

So if you have ten conditions in your Flow and will use the value of the item list, you can preset in the column for ten conditions, if it was failed, you can get the 'No' directly.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-litu-msft ,

 

Thanks for the suggestion. I will be using the compose action to validate conditions and log the outputs of it as our new requirements is to log all outcomes of every condition.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,297)