handling inactive approvers in ITSM

Deepika54
Tera Contributor

Hi team,

 

I have a use case. If the approver is active false, the approval should go to its manager. It will be for the modules that have approval logic like for change, RITM etc.

 

I have written a Business Rule of type 'before insert' on sysapproval_approver table as all the approvals go here.

 

Below is the script

 

// Add your code heree
gs.log("inactive approver");
if(current.approver.active==false)
{
gs.log("inactive approver2");
current.approver=current.approver.manager;
}
 

 

It is working fine for single approval but for some flow where there is a group based approval, it is not working.

The log is printing inactive approver but it is not coming inside the if block

Am i missing something. Kindly help

2 REPLIES 2

Nikhil Bajaj9
Giga Sage

Hi @Deepika54 ,

 

As youa re picking only one approver using current.approver - Rather you should pick all approvers in the Array, than in the array check who all are inactive or active. In short user array to pick all approvers and redesign your code.

 

If my answer helped you in anyways, please mark it- solution accepted.

 

Regards,

Nikhil Bajaj

Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj

Ankur Bawiskar
Tera Patron
Tera Patron

@Deepika54 

for group approval also it will work because for group approval also record is inserted into sysapproval_approver

If my response helped please mark it correct and close the thread so that it benefits future readers.

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