Remove approval on the basis of variable choice selection.

Cindy Sim
Tera Expert

I need to Remove the approval on request level when “add” is selected in the variable “Need to do?” question, without changing the  Catalog Item Request workflow configuration. How can I do it?

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@Cindy Sim 

you can try to use before insert BR on sysapprova_approver and check approval is for REQ but you won't get the value of RITM variable as RITM is not created by then

If you are able to get then you can skip it

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I am trying to use BR but it is not working,

(function executeRule(current, previous) {

// Only for specific Catalog Item
if (current.cat_item != 'CAT_ITEM_SYS_ID')
return;

// Variable check
if (current.variables.need_to_do != 'add')
return;

var req = new GlideRecord('sc_request');
if (req.get(current.request)) {

// Mark request as already approved
req.approval = 'approved';
req.update();
}

})();

Hello @Cindy Sim ,
You should glide on RITM record as "sc_req_item" record manages the approval not the Request(sc_request), it has just associated RITM with it...

just replace this code, this will work

// Update approval directly on the RITM
    current.approval = 'approved';
    current.update();

 

If my response helped mark it as helpful and accept the solution...