- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 12:55 PM
Hi Everyone!
I have been working on SLAs for the request item level in our instance. I have the SLA starting and pausing when needed. The problem I am having is that I want to have the SLA end when a TASK (this TASK will always be one that is open for the Requested Item) has been assigned. I have tried business rules, UI actions, and client scripts and none have helped with populating data from the TASK up to the requested item. I also can't pull the TASK.assigned_to using the selections on the SLA definition. I just wanted to see if anyone has had any experience with this.
Thank you so much!
Ashley
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2017 10:56 AM
I got this code working:
(function executeRule(current, previous /*null when async*/) {
var kids = new GlideRecord ('sc_task');
kids.addQuery('request_item', current.request_item);
kids.query();
//gs.addInfoMessage("This is requested item number: " + current.number);
//gs.print("This is the requested item number: " + current.number);
while (kids.next()) {
var parent = new GlideRecord ('sc_req_item');
parent.addQuery('sys_id',kids.request_item);
parent.query();
while (parent.next()) {
//gs.addInfoMessage("This is a test: " + parent.number);
//gs.print("This is a test: " + parent.number);
//gs.addInfoMessage("backordered before: " + parent.u_sla_state);
//gs.print("backordered before: " + parent.u_sla_state);
//gs.addInfoMessage("SLA " + kids.u_sla_progress);
if (kids.u_sla_progress == true ) {
parent.u_sla_state.setValue('true');
parent.update();
//gs.addInfoMessage("backordered after: " + parent.u_sla_state);
//gs.print("backordered after: " + parent.u_sla_state);
}
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2017 11:47 AM
That's what my above comments were about. I was trying to create a BR that did this and it wasn't working. The screenshot is above.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2017 12:38 PM
Use this script in Before Business rule.
var kids = new GlideRecord ('sc_task');
kids.addQuery('request_item', current.sys_id);
kids.query();
while(kids.next()){ //function was misssing here
if(kids.u_sla_progress == true) {
current.u_sla_state= true;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2017 11:48 AM
Hmmm. I'd probably break-up the SLA into multiple SLAs. Or have one that spans the entire time the RITM is active and then have other ones that track the approval, the individual tasks, etc. Each organization has different requirements, so, it's up to your leadership to determine what needs to be tracked.
I'll post another video dot walking the other when I get a chance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2017 11:38 AM
However, awesome video! Very helpful for people!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2017 10:56 AM
I got this code working:
(function executeRule(current, previous /*null when async*/) {
var kids = new GlideRecord ('sc_task');
kids.addQuery('request_item', current.request_item);
kids.query();
//gs.addInfoMessage("This is requested item number: " + current.number);
//gs.print("This is the requested item number: " + current.number);
while (kids.next()) {
var parent = new GlideRecord ('sc_req_item');
parent.addQuery('sys_id',kids.request_item);
parent.query();
while (parent.next()) {
//gs.addInfoMessage("This is a test: " + parent.number);
//gs.print("This is a test: " + parent.number);
//gs.addInfoMessage("backordered before: " + parent.u_sla_state);
//gs.print("backordered before: " + parent.u_sla_state);
//gs.addInfoMessage("SLA " + kids.u_sla_progress);
if (kids.u_sla_progress == true ) {
parent.u_sla_state.setValue('true');
parent.update();
//gs.addInfoMessage("backordered after: " + parent.u_sla_state);
//gs.print("backordered after: " + parent.u_sla_state);
}
}
}
})(current, previous);