send the approval by using of Business Rule?

Rakhesh
Kilo Guru

Hi All,

I Have an issue., I want to send the approval by using of Business Rule. Clearly., We have a field called 'SCM'.it is choice list (Mangers). I want to send the 'SCM' to approval when the ticket status changes from 'onHold' to 'Request Approval'. 

For this scenario i wrote one BR after

I attached the all the script i wrote.Please have a look and help me where am wrong.

Thanks

Rakhesh

find_real_file.png

 

find_real_file.png

1 ACCEPTED SOLUTION

answer=[];
var app = current.u_scm;
var arr = app.split(',');
for(var i = 0; i<arr.length;i++){
var name1 = arr[i].toString();
gs.log('approver name', name1);

var getapprovar=new GlideRecord('sysapproval_approver');
getapprovar.initialize();

getapprovar.sysapproval = current.sys_id;

getapprovar.approver = name1;

getapprovar.state='requested';

getapprovar.insert();
}

I hope this will work, can you give a try. I did the testing in my instance and it worked.

 

View solution in original post

9 REPLIES 9

You can try below code:

 

answer=[];
var app = current.u_scm;
var arr = app.split(',');


for(var i = 0; i<arr.length;i++){
var name1 = arr[i].toString();
gs.log('approver name', name1);

var getapprovar=new GlideRecord('sysapproval_approver');
getapprovar.initialize();
answer.push(name1);
getapprovar.insert();
}

 

Thanks
Shashikant

Hit Helpful or Correct on the impact of response.

I tried and  i applied each line to 'log'.All logs are coming but it is not insert into the approval.

same script i used what you are gave.

answer=[];
var app = current.u_scm;
var arr = app.split(',');
for(var i = 0; i<arr.length;i++){
var name1 = arr[i].toString();
gs.log('approver name', name1);

var getapprovar=new GlideRecord('sysapproval_approver');
getapprovar.initialize();

getapprovar.sysapproval = current.sys_id;

getapprovar.approver = name1;

getapprovar.state='requested';

getapprovar.insert();
}

I hope this will work, can you give a try. I did the testing in my instance and it worked.

 

What if you want to add two approvers and either one of those approvers can approve?

Rakhesh
Kilo Guru

Thank you!!

It's working.Thanks for your support to getting out this issue. 🙂