Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Understand the Flow Designer with Example

Community Alums
Not applicable
Hello Community, 
Hope you are doing well!
Looking towards the advantages and flexibility that flow designer provides over Workflow, most organizations are switching to Flow Designer.
I have composed this article in such a way, it will help...
• the beginner to understand the flow from scratch
• the mediator to know the hidden capabilities of flow
• the experts to get new ideas to utilize flow in different ways

- Flow Designer -

Definition: A Flow consists of properties, a trigger, a sequence of actions, and the data collected or created. The trigger specifies the conditions that start the flow. When the trigger
condition is true, the system starts the flow.

Benefits of Flow Designer
1. Flow Designer combines multiple platform automation capabilities, configurations, and runtime information so process owners and developers can create, operate, and troubleshoot flows from a single interface.
2. Natural language descriptions are used to help non-technical users understand triggers, actions, inputs, and outputs. You do not have to script.
3. Reduces development costs by providing a library of reusable flow components in the base system created by ServiceNow developers.
4. Reduces upgrade costs with upgrade-safe platform logic replacing complex custom scripts.
5. Develop, share, and reuse your custom flow components with other flow designers.
6. Expand Flow Designer to integrate with external instances and third-party applications with a separate subscription to IntegrationHub.

Use case: To send a notification every week to groups with more than 10 incidents assigned.

We are going to configure the flow in the below 3 steps to accomplish the Use Case:
• CREATE A FLOW DESIGNER
• CONFIGURE TRIGGER
• CONFIGURE ACTIONS
• SAVE, TEST, and ACTIVATE

Before we start, here is the final look of this flow which you can refer to understand the logic, steps, and sequence of actions.

PrasadS_2-1665070348143.jpeg

 

Step 1) Navigate and CREATE A FLOW DESIGNER with your details like below.
Procedure: Navigate to All > Process Automation > Flow Designer

PrasadS_3-1665070387004.jpeg

 

Step 2) CONFIGURE TRIGGER

PrasadS_4-1665070497830.jpeg

 

Step 3) CONFIGURE ACTIONS
We now move to the actions section. The action section tells the flow what to do.
We are going to configure the following 8 Actions:

1. Look Up Incident Records action
2. For Each Item Flow Logic
                  3. Look Up Incident Records action
4. If Flow Logic
5. Send Email
6. Set Flow Variables
7. Log Action(!--- Optional ---!)
8. Log Action

Let's start with the first...
1. Look Up Incident Records action
Configure the 'Look Up Records' action to get all the list of incident records created or updated after last week. Please refer to the below conditions to add a filter.
action_1.jpg

2. For Each Item Flow Logic
Configure the 'For Each' flow logic as shown below.
Slide2.JPG

3. Look Up Incident Records action
Configure the 'Look Up Records' action to get a list of all the incidents that have an assignment group equal to the incident record which is created/updated this week.
Slide3.JPG
Note: As the result of the above action we will get the count of total incidents with the same assignment group. We will use those data pills in upcoming actions.

4. If Flow Logic
Before moving to the next action. 'Save' the flow and Let's Create a Flow Variable.
Slide4.JPG

Now, let's configure the 'If' Flow Logic
Slide5.JPG
Drag and drop highlighted count data pill and Flow variable EmailSentToAssiGroups in the condition

5. Send Email Action
Before moving to the next action. 'Save' the flow and let's develop a Script Include.

Script Include name = GetUserList with below script.
Funtion Name = getMemberSysreturn()
Create a function 'getMemberSysreturn' to pass the group name as a parameter. And function will return the list of email IDs of Assignment Group members.

 

 

var GetUserList = Class.create();
GetUserList.prototype = {
initialize: function() {},

getMemberEmailIds: function(groupName) {

var answer = [];
var userList;
var mem = new GlideRecord('sys_user_grmember'); //GlideRecord the mentioned table to get email ID.
mem.addQuery('group', groupName); 
mem.query();

while (mem.next()) {
answer.push(mem.user.email); //Dot-walk User field as it is a Reference field
}
userList = answer.join(',');
return userList;
},

type: 'GetUserList'
};

 

 

Let's configure the 'Send Email' Action to send an email to the members of the assignment group which has more than 10 incidents.
Please Note Following fields are mandatory: To, Subject and Body. Refer to the below picture for more details.
Slide7.JPG
We have to retrieve the list of email IDs of Assignment Group members. Write the below script in the 'To' section.

 

 

var AssignmentGroupSysID = fd_data._2__for_each.item.assignment_group.sys_id;
var gr = new GetUserList(); //Script Include Name
var EmailList = gr.getMemberEmailIds(AssignmentGroupSysID);
return EmailList;

 

 

Send Email Action allows us to compose a dynamic Email Body. You can use available data pills to make it dynamic. Please refer to Message Body and compose yours:

 

 

Hello,

To all the members of [DOT WALK: 2 - For Each --> Incident Records --> Assignment Group --> Name]

More than 10 Incidents are assigned to Your group. Below is the List:
[DOT WALK: 3 - Look Up Records --> Name]

Please act soon.

Thank you,
Management Team

 

 

6. Set Flow Variable Logic
Configure 'Set Flow Variable' to push sysID of the assignment group to an email that is already sent. Basically, it will store the list of sysID of the Assignment group to an email is sent.
Slide8.JPG
Below is the script, we are appending the sys_ids of assignment groups dynamically and storing them in the flow variable.

 

 

var AssignmentGrpList = fd_data.flow_var.emailsenttoassigroups +','+ fd_data._2__for_each.item.assignment_group.sys_id;
return AssignmentGrpList; //For e.g. 477a05d153013010b846ddeeff7b1225,477a05d153013010b846ddeeff7b1225,k987dccec0a80po230a222a0f7900d06, 

 

 

7. Log Action(!--- Optional ---!)
Configure the log to show messages if the Email is already been sent.
Slide9.JPG

8. Log Action
Configure the Log Action to Log the list of SysID of assignment groups to which email is sent.
Slide10.JPG
Step 4) SAVE, TEST and ACTIVATE
test_flow.jpg

******************************************************************************
Thanks for visiting my article. If the article helped you in any way, please hit the like button/mark it helpful. So it will help others to get the correct solution.

See you in the next Article,
Prasad.

 

1 REPLY 1

Community Alums
Not applicable

Ready to get certified in ServiceNow Flow Designer?

 

If you're looking to validate your skills, the ServiceNow Flow Designer Micro-Certification is a great way to do it!

- Prerequisites: Basic knowledge of ServiceNow and some experience with Flow Designer.
- Learning Paths: Follow ServiceNow's recommended courses to prepare.
- Exam Details: Covers Flow Designer topics—make sure to check the exam format and marks weightage.
- Certification Fees: Check the official site for the latest pricing.

For all the details and to start your certification, visit...

ServiceNow Micro-Certification Flow Designer Exam Specification

(OR copy-paste https://nowlearning.servicenow.com/lxp/en/credentials/micro-certification-blueprint-flow-designer?id...

 

Good luck! 😊