When using a Check Condition step in Dynamics 365 workflows, you have the ability to to the following
- AND
- OR
- Group a combination of AND OR
In this #WTF post I will cover how to do this in Flow as the configuration is different. Remember, Flow uses the odata APIs of Dynamics 365 which results in different configuration. However our Dynamics 365 knowledge still applies 😁
Two types of modes
When using a condition step in Flow there's two modes that you can apply.
- Edit in Basic mode
- Edit in Advanced mode
Basic mode
This is the familiar "click and select" concept where you choose your condition and the field value.
Advanced mode
This is where you can make additional adjustments that is not available through basic mode. This is what we will use for AND OR statements. Why? In basic mode you cannot set more than one condition in a Flow condition step.
Breaking down Advanced mode
OK, this is where I give you my explanation. Disclaimer: I am not a developer and the terms I use is what makes sense to me. It is not the official explanation but this is how I have understood it which has helped my learning and adoption of Flow.
In a Flow condition step, it is calling a function to pass single or multiple parameters using some logic.
When we review the funky looking string in Advanced mode, this is how I see it:
Hopefully this makes sense to you.
How to do AND
You must use Advanced mode to be able to extend the function to have more than one criteria.
In my Flow condition, I was checking that the Customer equals Stark Industries and Product equals AI Support.
Again, here's my explanation of what the function is in Advanced mode.
How to do OR
Similar to AND but this time using OR instead.
How to group OR and AND statements
This one I figured out on my own. What I was able to work out is there's different parts to the function.
In Dynamics 365 workflows we are used to configuring it like the below,
We use "Group And" and "Group Or" clauses.
In Flow we apply the same logic in the following manner,
- In blue is the AND OR conditions
- In red is the two grouped OR conditions where the Product field value equals AI Support or Iron Man Armor.
- In green is the condition where customer equals Stark Industries
Bonus tips
Use GUID when referencing a lookup in a condition
In Dynamics 365 we are used to seeing the Name of the lookup value when referencing a related record in a condition.
In Flow we need to reference the GUID of a lookup value since it uses the odata APIs of Dynamics 365. In Unified Interface, it's easy to get the GUID in the URL.
Lookup record exists in target instance
If you export and import a Dynamics 365 workflow from a source instance into a target instance that references a related record through a lookup in a condition step, the workflow will not execute as expected if the record does not exist in the target instance.
Same principle applies in Flow so make sure the record does exist in the target instance. Otherwise when the Flow is imported into the target instance and the GUID does not exist, you're going to run into a problem.
Use Notepad++
Notepad++ is your best friend when it comes to making sure that you are not missing any close brackets which is what I demonstrated in my vlog. Notepad++ will highlight your brackets in red and it makes it easy to see where you are missing a close bracket.
Summary
To perform multiple conditions to use AND OR statements, and Group, you need to edit in Advanced mode to enter the correct function. It might appear as hard at first however you will get the hang of it. As mentioned earlier I am not a developer, but I was able to understand the concept of edit in Advanced mode when configuring the Flow condition step.
More #WTF coming. Stay tuned 😎
#FlowFever
#FlowFever