Keeping Assigned To from approving their own change

gwow
Kilo Contributor

I'm looking for ideas on keeping the assigned to from approving their own changes. Whenever a change is created, the approval group is the ("approver: " + assigned group) that is tasked for that particular change. If the assigned to is a member of both the assignment group and approval group, they will have the ability to approve their own change. I would like to be able to limit or not allow the assigned to the ability to approve their own change. Any ideas on how to go about and completing this task?

11 REPLIES 11

arnabwa
Giga Guru

Hi All,



I had a similar requirement on catalog task approval process. We were asked to restrict a user to approve a task which contained that user in the approver column for the task and also that user is the one in the Requestor of the corresponding RITM. We made a scheduled job to achieve this.




var ctask = new GlideRecord('sc_task');


ctask.addQuery('state','8');       // state is awaiting approval


ctask.query();


while(ctask.next()){


  var appr =   new GlideRecord('sysapproval_approver');


  appr.addQuery('sysapproval', ctask.sys_id);   // querying for the particular task number


  appr.addQuery('approver', ctask.request_item.request.requested_for);


  appr.query();


  while(appr.next()) {


  appr.state = 'not_required'; // we set the state to "Not Required" for the corresponding user


  appr.update();


  }


}



Well we had a problem with business rules (Don't really remember what was the issue) and hence we opted for Scheduled job.



Thanks,


Arnab


ServiceNowServ
Tera Contributor