
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 02:51 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 05:11 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 03:49 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 04:15 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 05:11 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 02:33 PM
What if you want to add two approvers and either one of those approvers can approve?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 05:52 AM
Thank you!!
It's working.Thanks for your support to getting out this issue. 🙂