Need to auto approve RITMs if the requested_by is part of a certain group.

Logan Calhoun
Tera Expert

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! 

7 REPLIES 7

Yousaf
Giga Sage

Hi Logan,

Please refer if auto approval rule works for you.

Set automatic approval rules

 

Mark Correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***

I have looked through this and I don't believe this would help as I need to check if the "requested_by" is part of the group and if it's not then go through the normal approval process.

Michael Jones -
Giga Sage

You can do this with a Business Rule on the sysapproval_approver table. 

Advanced: 

Run Before, on Insert. 

Actions: State To Approved

Under Advanced, in the Condition field, enter something like this with the name of the group you want to check for membership of - all one line (it's a bit long). 

current.document_id.getRefRecord().sys_class_name == "sc_req_item" && gs.getUser().getUserByID(current.document_id.getRefRecord().requested_for).isMemberOf('<Your_VIP_Group>')

See if that meets your needs or at least gets you close. 

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!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Thanks for the reply!

I am still new to the ServiceNow platform so I might be missing something here.

In the business rule I have:

 

(function executeRule(current, previous /*null when async*/) {

    if(current.document_id.getRefRecord().sys_class_name == "sc_req_item" && gs.getUser().getUserByID(current.document_id.getRefRecord().requested_for).isMemberOf('Catalog Request VIPs')){
        current.document_id.getRefRecord().approval == approved;
    }

})(current, previous);

 

But the request are not auto approving yet.