Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications

|

And Operator in Flow

Post Author: Joe D365 |

We've devoted several blog posts in 2018 to Microsoft Flow because of its awesome ability to automate workflows quickly with a no-code/low-code approach. If you haven't read our recent post on building Flows in mere minutes, please check it out – it's worth your time!

Today's post is devoted to Flow's And operator, which enhances the automation potential of our workflows. In certain business scenarios, we want the action we take to be based on multiple checks – e.g., if condition A is true AND condition B is also true, then take subsequent action, otherwise take no action. To help illustrate this, let's consider a real-world scenario.

Let's say that we are operating a roofing company; one of our main tasks involves sending our technicians to inspect roofs for damage. As the technicians inspect the roof, they mark Yes or No to various questions in an inspection checklist on their mobile device. Next, let's say that if, for example, they find water stains (condition A) AND they also find water leaks (condition B), we want to automatically send the customer an email suggesting that the best way to prevent potential future water-related problems is by installing smart sensors on their roof. Here's how we can accomplish this with a Flow.

1. We will trigger our Flow when a record is created. In our case, we are creating an Inspection Check Lists record.

flow

2. Next, we need a Condition. To create one, click New Step > Condition Control.

flow

Now, in this case, we want to add two conditions. With Flow, multiple conditions are added in advanced mode in the form of a formula. Don't be intimidated! Just because we're going into advanced mode does not mean we're doing anything especially technical or advanced – we're simply tweaking the formula, which can only be done in this mode. The following steps provide an easy way to generate a formula for our And condition.

3. Let's add the first condition: is our vr_waterleaks field equal to true? Here, we need some very simple code to define a true value: @equals(triggerBody()?['vr_waterleaks'], true).

flow

4. As stated earlier, the way to hardcode multiple conditions is by clicking Edit in advanced mode. Once in advanced mode, copy the code from the previous condition (Step 3) without the "@": @equals(triggerBody()?['vr_waterleaks'], true). You'll need this in Step 7.

5. To add our second condition, we will go back to Edit in basic mode, clear the condition created in Step 3, and create the second condition: is our Water Staining field equal to true? Again, we need some very simple code: @equals(triggerBody()?['vr_waterstaining'], true).

flow

6. Now we need to combine the two conditions. While still viewing the second condition, once again click on Edit in advanced mode. At the beginning of the code, add an And clause by typing "and(," between "@" and "equals." It should now look like the After column:

Before

After

@equals(triggerBody()?['vr_waterstaining'], true) @and(,equals(triggerBody()?['vr_waterstaining'], true)

7. Next, paste the code for the first condition (copied in Step 4) between "and(" and ",equals." It should now look like After column:

Before

After

@and(,equals(triggerBody()?['vr_waterstaining'], true) @and(equals(triggerBody()?['vr_waterleaks'], true),equals(triggerBody()?['vr_waterstaining'], true)

8. Finally, add a close parenthesis – ")" – to the very end of the formula. It should now look like After column:

Before

After

@and(equals(triggerBody()?['vr_waterleaks'], true),equals(triggerBody()?['vr_waterstaining'], true) @and(equals(triggerBody()?['vr_waterleaks'], true),equals(triggerBody()?['vr_waterstaining'], true))

9. Hit and you're all done creating an And clause that will take an action you define if and only if both conditions are met.

Hopefully, you can think of many uses for this Flow operator in your own organization. To learn more about Flow, please visit our website. If you're interested in taking a Flow class, we offer two different Power Apps and Flow courses: one focuses on Model Apps and one on Canvas Apps.

Happy Flow'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends