- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 02:34 PM
Hi Community, I have a requirement to copy the ticket number from the rm_story to the sc task work notes whenever the story is completed. We currently have a ui configuration to create a story from a catalog task and whenever the story is completed the task is close. I would like to copy the story number to the task work notes but my script is not working. Any help would be appreciated. Below is the script, please let me know what is wrong.Thanks
Business Rule
Table - sc_task table
After - insert/update
var re = new GlideRecord('rm_story');
re.addQuery('sys_id', current.parent);
re.query();
if(re.next()) {
if(re.state.changesTo('20')){
var rt = new GlideRecord('sc_req_item');
rt.addQuery('requested_item', current.sys_id);
rt.work_notes = "Story" + re.number;
rt.update();
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 06:19 PM
ok. The business rule will be on the rm_story table with a condition: State - changeto - Closed
The script will look something like this:
var gr = new GlideRecord('sc_task');
gr.get(current.initial_task);
gr.work_notes = "Story " + current.number;
gr.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 05:53 PM
The ui action that creates a story from a SCTask, is parent populated with the SCTask or the RITM?
The business rule will need to run on the rm_story table, as that's where the update is occurring and the state is changing, but not sure how you're tied to the RITM/SCTask to advise beyond that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 06:11 PM
The ui action populates the sctask number on the rm_story table in a field call initial_task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 06:19 PM
ok. The business rule will be on the rm_story table with a condition: State - changeto - Closed
The script will look something like this:
var gr = new GlideRecord('sc_task');
gr.get(current.initial_task);
gr.work_notes = "Story " + current.number;
gr.update();