Hemanth M1
Giga Sage
Giga Sage

Hello Community,

 

Are you using flow designer flow variables? If so, do you know their potential?

 

Let's understand this with a few practical examples 😁:

 

1. Let's say you want to check if any ad hoc catalog task has been created. If so, you need to wait for that task to complete before proceeding with request closure

 

When we look at this scenario, we might immediately think to use

 

"Look Up Record" and "Wait for Condition" right? However it's not necessary that an ad hoc task will always exist.

If you use "Look up Record" and no record is found, the whole flow will error out. To counter this you need to check the "Don't fail on error" checkbox (set it to true) and then use an "If" condition to check if the record exists before using "Wait for Condition." using status which not reliable!

 

OR

If you use this logic directly in "Wait for Condition" to get an ad hoc record, it will fail when there is no ad hoc record

 

Is there a better way to handle this?

yes, Use reference type flow variable.

 

 

Below is a sample catalog item with the following steps:

A) Submit the catalog item.

B) Send for Requested For manager approval.

C) Check if an ad hoc task exists using a flow variable.

D) Fulfill the RITM.

 

Catalog Item:

 

HemanthM1_0-1754156649178.png

 

Flow Designer flow:

HemanthM1_1-1754156815874.png

Lets understand the above flow variable logic 

1)Create a flow variable type reference and select "sc_task" table

HemanthM1_2-1754156945852.png

 

 

HemanthM1_3-1754156990082.png

 

2)Add a logic get "sc_task" record

HemanthM1_4-1754157117800.png

 

3)use this in the Wait for condition if record found as below

HemanthM1_5-1754157361759.png

 

Result:

RITM - Approval (Approved) and Ad hoc task

HemanthM1_6-1754157514480.png

 

Flow context:😍 

 

This gives you more control over what to return when you set the flow variable.

 

HemanthM1_7-1754157701474.png

 

If you are using "Look Up Record," then you need to enable this option and use an "If" condition to check its output.

 

HemanthM1_0-1754200278189.png

 

 

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

 

My other articles :

 

Script Action: A Practical Example! 

 

A Quick Guide to Adding a Wizard Section to a Catalog Item in Catalog Builder! 

 

Set different “From” and “Reply To” emails for the Native and Flow designer Emails/Notifications. 

 

Read .CSV formatted files in ServiceNow 

 

Automate Assessment/Survey Testing with ATF(Including Multiple Option,Attachments &Reference fields) 

 

Set up interactive filter on UI builder (for data visualization reports and List records) 

 

Set Up "Step Based Request Fulfillment" for Catalog Items 

 

Need to know about Schedules and Define them in SLAs 

 

My ServiceNow Share Projects:

 

Return Assessment Feature in ServiceNow 

 

Add signature and update fields to a fillable PDF document

 

Get Record URL action in the flow designer (Use it in the Send Email action) 

 

Domain Separation: Alert Developers/Users when open a configuration record (ex: Business rules) in d... 

 

Custom Generic Flow Action to Create Assessment 

Comments
Nilesh Pol
Tera Guru

@Hemanth M1 Very value added post, thank you for sharing

Hemanth M1
Giga Sage
Giga Sage

Hi @Nilesh Pol 

 

Thank you!

Version history
Last update:
‎08-02-2025 11:38 PM
Updated by:
Contributors