Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to trigger a single notification to requestor for the Approval record?

SubhashreeS4370
Tera Contributor

Hi Team,

 

We have a requirement to auto cancel any RITMs, that are not approved within 30days. We are looping through approval records (sysapproval_approver) table, fetching the RITMs, then calling the notification which is sending emails to each approver separately for the same approving record.

 

Current behavior: User is receiving multiple notifications along with approving user.

 

Expected Behavior: Our goal is to notify the user via Additional comments (without sending multiple notifications to the requestor).

 

Flow configuration:

SubhashreeS4370_3-1788360133564.png

 

Notification:

SubhashreeS4370_1-1788360050719.png

 

SubhashreeS4370_2-1788360085263.png

 

Please verify our Flow and let us know how can we trigger a notification to the Requestor (via single notification specific to one ticket) instead of multiple notifications which is happening happening via For-each loop.

 

Thank you in advance!!

 

3 REPLIES 3

HarishKumar6668
Kilo Sage

Hi @SubhashreeS4370 ,

What is the trigger configured for the Flow? If the Flow trigger is scheduled, I would suggest handling the cancellation and notification at the RITM level rather than triggering the notification from each approval record. This will help avoid sending multiple notifications for the same RITM when there are multiple approvers.

You can follow the below approach:

  1. Fetch the approval records from the sysapproval_approver table that were created more than 30 days ago and are still in Requested state.
  2. From these approval records, identify the associated RITM sys_ids and store them in a Flow variable.
  3. Reject the pending approval records associated with those RITMs and exit the loop.
  4. Perform a Look Up Records on the RITM [sc_req_item] table using the collected RITM sys_ids using filter sys id is one of <Flow variable>.
  5. Use a For Each loop to iterate through the RITMs returned by the lookup.
  6. Within the loop, trigger the cancellation notification from the RITM level.

 

If you find this approach useful, please mark the response as Helpful and Accept the Solution.

Regards,
Harish

Hi @HarishKumar6668 ,

 

Thank you for the solution. However,

We are facing an issue with storing multiple RITM Sys IDs in a flow variable. Currently, the flow variable is configured as a String type, and it only stores a single RITM Sys ID.

Could you please advise on the best approach to store multiple RITM Sys IDs in a flow variable so that they can be referenced in a subsequent step to update the RITM stage to "Request Cancelled"?

 

Any guidance or recommended implementation would be greatly appreciated. Please find the attached screenshots of flow variable and flow designer.

Flow variable:

JaganN971616731_5-1789130261905.png
 
Getting sys IDs of sysapproval_approver record:
JaganN971616731_4-1789130244620.png

 

Storing RITM sys ID in Flow variable:
JaganN971616731_1-1789130113904.png
Using Look up record in RITM record and matching the sys ID with stored flow variable:
JaganN971616731_2-1789130124030.png

 

Hi @JaganN971616731 ,

Sorry for the late reply.

Store the comma-separated sys_ids in a Flow Variable and use the Look Up Records action with a filter where the sys_id is one of the values from the Flow Variable. You can then use a For Each loop within the flow to process the returned records.You don't need to use an Array-type variable for this.


Regards,
Harish