Need to auto approve RITMs if the requested_by is part of a certain group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2022 01:10 PM
I have created a group that has all VIPs and Executives. When the a request is put in, with the requested_by being apart of that group, I need the RITM to auto approve. I have successfully done this in workflows but it would be very work intensive to have to go through each workflow and change them. My plan was to add a business rule to the RITM table but I have been unsuccessful in doing so.
Any help would be appreciated!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2022 04:07 PM
Follow this structure:
On the main record click advanced.
Click on the When to Run tab: When = Before, check the box for Insert.
Click on the Actions tab:
Select: State
Select: To
Select: Approved
Click on the Advanced Tab
Enter the condition in the single-line text for condition at the top of that section:
current.document_id.getRefRecord().sys_class_name == "sc_req_item" && gs.getUser().getUserByID(current.document_id.getRefRecord().requested_for).isMemberOf('Catalog Request VIPs')
No code goes in the Script section - just the condition.
I hope this helps!
If this was helpful, or correct, please be kind and mark the answer appropriately.
Michael Jones - Proud member of the GlideFast Consulting Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 04:42 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 06:20 AM
You're not using a Requested For variable type on your items? You might want to look into those going forward (they automatically set the Requested For on the RITM) but, if you have a variable on item named requested_by then try this condition.
Checks if the approval is tied to a RITM.
Gets the user record for the value stored in a variable named requested_by.
Checks if the user is a member of your group.
current.document_id.getRefRecord().sys_class_name == "sc_req_item" && gs.getUser().getUserByID(current.document_id.getRefRecord().variables.requested_by).isMemberOf('Catalog Request VIPs')
You can test this to see if it will return true of false by creating a request with an approval you think should be auto approved (eventually) - go to the approval and get the sys_id, and then run this in a background script - if it returns true, then it should work (make sure you have the actions set on the BR to update the state).
var sys_id = '0a8fc69107ad5110c5cff1e08c1ed0ec'; //sys_id of your approval
var current = new GlideRecord('sysapproval_approver');
current.get(sys_id);
var result = (current.document_id.getRefRecord().sys_class_name == "sc_req_item" && gs.getUser().getUserByID(current.document_id.getRefRecord().variables.requested_by).isMemberOf('Catalog Request VIPs'));
gs.info(result);
I hope this helps!
If this was helpful, or correct, please be kind and mark the answer appropriately.
Michael Jones - Proud member of the GlideFast Consulting Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!