Change Request Approval Validation

sunny13
Giga Expert

The Change Request workflow should not allow the 'Requested By' to approve their own change as IT Owner or Business Owner.

For example, CHGxxxxx was submitted by IT Owner and he assigned it to the IT Owner group, IT_Owners which includes him along with other approvers.   Technically, it work as designed, but we need to put a rule in place to avoid and eliminate this situation happening in the future in the event Change Management doesn't manually catch it.

IF a request is raised by IT owner and the same ticket is assigned to a group which involves that user who created the ticket he should not be allowed to Approve teh request.

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

Few ways of doing this ..



First changing the condition of 'Approve ui action' and something as below


(isApprovalMine(current) && curret.sysapproval.sys_class_name=='change_request' && !(gs.getUser().isMemberOf(group.assignment_group)))



If you don't want to do that, add a before update business rule on the approvers table and abort the action if the current user of the group ... You can use the fields from the above condition to pick up needed values...


View solution in original post

4 REPLIES 4

Kalaiarasan Pus
Giga Sage

Few ways of doing this ..



First changing the condition of 'Approve ui action' and something as below


(isApprovalMine(current) && curret.sysapproval.sys_class_name=='change_request' && !(gs.getUser().isMemberOf(group.assignment_group)))



If you don't want to do that, add a before update business rule on the approvers table and abort the action if the current user of the group ... You can use the fields from the above condition to pick up needed values...


Thanks Kalai.


Thanks Saurabh


saurabh1
Giga Contributor

Please check the below code it can be used in approver activity in workflow.



customize the script according to your need. it will solve your issue.



var answer = [];


  var getUsers= [];


  var grp = new GlideRecord('sys_user_grmember');


  grp.addQuery('user','<>',current.requested_by.toString());


  // you can add query here to check group if all approvers are   in a specific group


    // grp.addQuery('group.name',name of group);


  grp.query();


  while(grp.next())


  {


  getUsers.push(grp.user.toString());



  }



  answer = getUsers.toString();