- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018 08:10 AM
I want to update a fields on Incident form, when a task_SLA breaches. There's a workflow associated with the SLA.
When SLA is breached, I want the workflow to (1) reset (update) a field ('State') on Incident form to ''Active' and (2) update the work notes on Incident form to t
To update fields using the workflow activity 'X =Set Values', I tried by selecting appropriate fields in the drop-down boxes and picking up task-related fields for State and work-notes. But that didn't work.
Then I tried using the following script -
var parent_incident = new GlideRecord('incident');
parent_incident.addQuery('sys_id',current.parent.sys_id);
parent_incident.query();
parent_incident.next();
parent_incident.state = 2; // 2 - value for 'Active'
parent_incident.work_notes = "State reset to 'Active' by workflow";
parent_inc.update();
I still can't update the Incident record (fields 'State' and 'Work notes'). Can someone help?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018 08:36 AM
you can add run script on sla workflow with something like
var inc = new GlideRecord('incident');
inc.get(current.task);
if(inc.sys_class_name == 'incident'){
inc.work_notes = "State reset to 'Active' by workflow";
inc.state = 2;
inc.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018 08:36 AM
you can add run script on sla workflow with something like
var inc = new GlideRecord('incident');
inc.get(current.task);
if(inc.sys_class_name == 'incident'){
inc.work_notes = "State reset to 'Active' by workflow";
inc.state = 2;
inc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 08:59 AM
Worked first time like a champ! Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018 10:37 AM
Thanks a lot, Mike! Used the script you gave and it worked right away. I am very pleased. Thanks, again.