Add Requested for User to the Group after approval and Close RITM REQ after Approval (Script)

VishalSawant
Tera Contributor

Hi All,

I’m working on a requirement in ServiceNow and would appreciate your guidance.

Requirement:
We have a catalog item for ServiceNow access. It contains:

A variable “Service Required ” (dropdown) → includes Request Access

A variable “Type of Access” (dropdown) → includes View Ticket Access

Expected Behavior:
When:

Catalog item = ServiceNow access

Service Required = Request Access

Type of Access = View Ticket

And the RITM is approved

Then:

The Requested For user should be automatically added to a specific group (CAD group)

The RITM and REQ should be auto-closed (Closed Complete)

Constraint:

We are not allowed to use Flow Designer, so this needs to be handled via scripting (Business Rule or other approach)

2 REPLIES 2

Jordan Vignoni
Tera Guru

If you are unable to use Flow Designer, you could write a business rule that queries the sys_user_grmember table and adds a new record when the RITM meets the desired conditions.

HarishKumar6668
Tera Contributor

Hi @VishalSawant ,

You can use an "Insert" Business Rule on the RITM (sc_req_item) table and handle this as follows:

  1. Validate the conditions — Check if the Catalog Item, Service Required and Type of Access match the expected values.
  2. Trigger Approval — If conditions are met, call a Sub flow directly from the Business Rule using sn_fd.FlowAPI with the "Ask for Approval" action inside the Sub flow
  3. Post Approval — Once approved, add the Requested For user to the CAD group via sys_user_grmember and auto-close both the RITM and REQ by setting the state to Closed Complete

If you find this useful, please mark it as Helpful or Accept it as the Solution.

 

Regards,
Harish