Requester cannot be the approver at the same time(?)

Vladi1
Kilo Guru

Hello

I am looking for the alert message that would prevent self approval process in Service Catalog.

I found few scripts online how to display message (and even to clear the name in the field), but it won't break the process. The last update is that I have script that will display alert and delete the approver field regardless of the name.

 

Any advice and suggestions will be greatly appreciated.

Thank you

 

1 ACCEPTED SOLUTION

Vladi1
Kilo Guru

This is the script. Thank you Scott Peterson




function onSubmit() {


  var requester = g_form.getValue('variables.requester');


  var reqApprover   = g_form.getValue('variables.approver');


  if ( reqApprover.toString() == requester.toString() ){


  g_form.hideFieldMsg('approver', true);


  g_form.showFieldMsg('approver','Approver can not be same as the Requester!','error');


  g_form.setValue('variables.approver','');


  g_form.getControl('variables.approver').focus();  


  return false;


  }


};


View solution in original post

8 REPLIES 8

in my catalog there is not a variable called approver.............,

I am taking approver from sysapproval_approver table 

 

can you please help with this ......!

Thank you
Chandan

randrews
Tera Guru

i like the scripts you are being shown but I would use an onchange script instead of an onsubmit... nothing irritates me more than completing a form THEN being told i filled it out wrong..




so the only real change from Vladimir's script would be to replace the "return false" with g_form.clearValue('variables.approver');


TiffanyL
Tera Contributor

I've noticed this business rule is turned on in OOB, however it doesn't work against knowledge article document types. Has anyone gotten this BR to eliminate self approval requests where a knowledge author is a member of the assignment group configured to approval to publish action? 

Rahil Mirza
Tera Contributor

On change script