Ability to skip a second level approver if it's the same first (managerial) approval

mikesheaffer
Tera Contributor

I have a catalog item where a user would request access to a specific area within an enterprise system.   We require their manager to then approve their access, which works correctly based on the workflow.   We then require approval from that department head (based on the variable the requester chooses from a list) before the task is created to provide the access, which works correctly based on the workflow.

However, there are times where the manager is also the department head, so that once they approve as manager, they then get that second approval as department head.   I'm looking for a way to bypass this second approval if it's the same name as manager approval.  

Thank you for any suggestions.

13 REPLIES 13

Blaze2
Kilo Guru

Did the Approval Rules work for you? Or did you need something else?


Try this business rule



Duplicate Approval Requests Not Required' Business Rule


Name: Duplicate Approval Requests Not Required


Table: Approval [sysapproval_approver]


When: Before


Insert/Update: true


Condition: current.state.changesTo('requested')


Script:



//Check to see if user has previously approved
approveDuplicateApproval();


function approveDuplicateApproval(){
      //Must have link to record being approved
      if(current.document_id || current.sysapproval){
              //Query for approval records for this user/record
              var app = new GlideRecord('sysapproval_approver');
              //Handle empty document_id and sysapproval fields
              if(!current.document_id.nil()){
                      app.addQuery('document_id', current.document_id);
              }
              else if(!current.sysapproval.nil()){
                      app.addQuery('sysapproval', current.sysapproval);
              }
              app.addQuery('approver', current.approver);
              app.addQuery('state', 'approved');
              //Optionally restrict to current workflow
              //app.addQuery('wf_activity.workflow_version', current.wf_activity.workflow_version);
              app.query();
              if(app.next()){
                      //If previous approval is found set this approval to 'approved'
                      current.state = 'not_required';
                      current.comments = "Approval marked by system as 'Not Longer Required' due to a previous approval on the same record by the same user.";
              }
      }
}




Prevent Redundant Approval Requests in ServiceNow - ServiceNow Guru


fpuzon
Tera Contributor

Giving this a try now!   Will report back shortly.


Mr_Blue
Tera Expert

Hello Mike,

Can you please share me what resolution did you find here.

Thanks & Regards,