
- 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 02:58 AM
I believe your second line in query should be
getApprovar.addQuery('sysapproval', current.sys_id);
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 03:31 AM
Hi thanks for reply,
I followed your code still no luck to me. Even the logs also not coming can you check the below code please
answer=[];
var app=current.u_scm;
var getapprovar=new GlideRecord('sysapproval_approver');
getapprovar.addQuery('sysapproval', current.sys_id);
gs.log("----approver inserting 1---"+sysapproval);
getapprovar.query();
while(getapprovar.next()){
answer.push(getapprovar.app.toString());
gs.log("----approver inserting 2---"+current.number);
getapprovar.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 03:38 AM
You want to create/add Users under approval table right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 03:42 AM
i want to send the SCM to Approvals like adding the SCM Under Approval Table