Create a custom flow to generate an object for each record in a list
On this page
Create a custom flow to generate an object for each record in a list
Generate an object for each User record in a list. Learn how to use flow logic to iterate through a list of records.
Before you begin
-
Role required: admin
About this task
Use this example to see demonstrations of these operations and steps.
-
Create a flow that runs on a daily schedule.
-
Look up User records filtered by the Department provided as an input.
-
Add flow logic that runs for each User record you looked up previously.
-
Create a contact object for each User record using the custom action you created previously.
-
Create a log message for each User record.
Procedure
-
Navigate to All > Process Automation > Flow Designer.
The system displays the Workflow Studio landing page.
-
Select New > Flow
The system displays the Flow Properties dialog.
-
Enter these sample values.
Field Value Name Create Contact Objects From Users Application My Application Run As User who initiates session -
Select Submit.
The system displays the Workflow Studio interface.
-
Select Click to add a Trigger > Date > Daily.
-
Select Done to close the trigger.
-
Select Click to add an Action, Flow Logic, or Subflow > Action > ServiceNow Core > Look Up Records.
The system adds the action to the flow.
-
For Table, select User [sys_user].
-
For Conditions, add these values.
-
[Department][is][Development] [AND]
-
[Email][is not empty]
-
-
Configure these field values.
Field Value Order by Name Sort a to z Max Results 1000 -
Select Done to close the action.
-
Select Click to add an Action, Flow Logic, or Subflow > Flow Logic > For Each.
The system adds the flow logic to the flow.
-
For Items, select [1->User Records].
Note: You can select the Action 1 User Records data pill from the data panel or from the Data Pill Picker button.
-
Select Done to close the flow logic.
-
Select the plus icon to add a child item to the For Each flow logic.
-
Select Action > My Application > Create Contact Object.
-
For userRecord [User], select [2->User Record].
Note: You can select the Action 2 User Record data pill from the data panel or from the Data Pill Picker button.
-
Select Done to close the flow logic action.
-
Select the plus icon to add a child item to the For Each flow logic.
-
Select Action > ServiceNow Core > Log.
-
For Message, select [2.1->contact].
Note: You can select the Action 2.1 contact data pill from the data panel or from the Data Pill Picker button.
-
Select Done to close the flow logic action.
-
Select Save.
Parent Topic:Complex data
Keep exploring.
Find another answer, or bring this documentation into your own tools.