In New for Developers in Kingston - Flow Designer, Action Designer, IntegrationHub, I touched on the basics of Flow Designer.
In this post, I’ll spend some time exploring Flow Designer in more detail. Instead of trying to look at every aspect of Flow Designer in one post (that’d be a long post), I’m going to walk you through the process of creating a simple flow and we’ll touch on many of the core concepts in the process.
The flow we’ll build:
- Is triggered when when a user is added to a group
- Looks up all existing members of the group
- Sends an email to every member of the group welcoming the new user
Launch Flow Designer
Launch flow designer by navigating to Flow Designer > Designer.
This opens the Flow Designer UI in a new window.
Create a new Flow
Click the + New button, and then click the New Flow option in the dropdown menu.
Fill out the form and then click the Submit button.
You will be taken to a new tab containing the newly created flow.
Define a Trigger
Triggers determine when the flow will run. Click the Click to add a Trigger button, and the list of available Triggers will open.
As you hover over each trigger type, inline documentation describing how the trigger functions will be shown. Click the Created trigger, and then populate the Table with the table of your choice. In our case, we want this flow to run every time a new record is created in the Group Member [sys_user_grmember] table. After selecting the table, click the Done button.
Note: We could have defined a condition, but we want this to run for every group member creation.
Add Actions
After the Flow is triggered, we want to execute a series of Actions. Add an action to the flow by clicking the Click to add an Action or Flow Logic button (or just click the big circle with the +).
Next, click the Action button.
This will open a searchable list of available actions.
Hovering over an action will display inline documentation about that action and what it is used for.Click the Look Up Records Action.
- Set the Table to Group Member [sys_user_grmember].
- Set the condition to Group is.
- Drag the Trigger > Group Member Record > Group data pill from the Data pane into the condition input.
We just did something very interesting. We took an output variable from the original trigger and used it to drive the Look Up Records query. This is a key concept in Flow Designer b when actions have outputs, those outputs can be used by subsequent actions.Because the output from the Trigger was a GlideRecord, we could drill into that GlideRecord and use the group field to drive the lookup query.
Loop Over Records
Next, we’ll add a For Each loop. Select the Click to add an Action or Flow Logic button, click Flow Logic and select the For Each menu item.
Next, choose the collection of records to loop over. In this case, we want to iterate over the result from the Look Up Records step.
Note: we could have also dragged/dropped the value from the data pane.
Adding Actions Inside a Loop
Now that the For Each loop has been configured, you can add actions inside it by clicking the + button under the loop. Any actions added this way will be executed once per record.
Add a Send Email Action.
- Expand 2 b For Each in the Data pane and drag the Group Member Record > User > Email value into the To input.
- Define a Subject that incorporates the user’s name taken from the Trigger.
- Write a Body message of your choosing.
- Click Done.
Test the Flow
Next, we need to test the flow. Flow Designer has built-in testing functionality that makes it easy to manually trigger flows and inspect the results. Click the Test button.
A new dialog will open. Choose the record you wish to test this flow against. Click the Run Test button. After the flow executes, click Flow has been executed. To view the flow, click here.
This will open the execution details for the test run. There is a wealth of information here b click everything!
Clicking the Trigger reveals more details info about the record that triggered this flow.
Clicking any action will show the runtime values passed into an action, the values returned by the action, log files, etc. In the screenshot below, we can see that there were four records returned by the group member query.
When inspecting the results of a loop, we can select which iteration we want to inspect. In the screenshot below, we’re looking at the 1st iteration out of four. We can see our flow configuration coming to life b the dynamic values we inserted into the subject line show up in the runtime value column with real values from the user record.
I’m really in love with the execution details view. This gives me everything I want to see about the flow’s execution at a glance, and I don’t need to go hunting through log files, or enable extra debugging to see the results of my test.
Activate the Flow
Now that we have a working flow, there’s one thing left to do: Activate it.
Confirm that you really want to activate this on the resulting confirmation dialog, and your flow is live!
Summary
This post touches on some key Flow Designer concepts:
- Triggers
- Looking up records
- Iterating over records
- Passing data from one action to the next
- Testing the flow and inspecting execution details
But there’s always more to learn. My advice? Just try stuff. Experiment with the other actions available to you. Play with if/else logic. Try out the approvals action.
I’ll keep writing about Flow Designer and IntegrationHub, but don’t wait for me!
Share this post
Twitter
Facebook
Reddit
LinkedIn
Email