
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 01:28 PM
I have found a bunch of articles for pushing catalog task work notes to the RITM work notes, but none are quite what I am looking for.
I need to push the task work notes to the RITM work notes but only for one catalog item, not all. I am not sure if I need a business rule for this, or if I can just use a run script in the workflow to push those notes?
I have tried both ways but have been unsuccessful so far.
Here is the business rule I attempted, if anyone could help out it would be much appreciated:
When to run: After Insert, Update
condition: current.work_notes.changes()
Table: sc_task
Script:
(function executeRule(current, previous /*null when async*/) {
var item = new GlideRecord('sc_req_item');
item.get(current.request_item);
if (item == '3c8f73a7db669f04dc05546adc96194b'){
item.work_notes = current.work_notes;
item.update();
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:39 PM
Yes, if condition is not required and here is the updated code.
(function executeRule(current, previous /*null when async*/) {
var item = new GlideRecord('sc_req_item');
item.get(current.request_item);
item.work_notes = current.work_notes.getJournalEntry(1); //Get last journal entry
item.update();
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:46 PM
That worked!
1 more question, is there a way to add "Task Work Notes:" + Whatever the comments in the work notes were, but leave out the date info? I know I can add "Task Work Notes: " + current.work_notes.getJournalEntry(1); //Get last journal entry
This is what I am getting currently;
2018-10-11 15:42:25 - Kristopher VanWagner (Work notes)
TESTING WORK NOTES 3
I dont really need the: 2018-10-11 15:42:25 - Kristopher VanWagner (Work notes)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 01:47 PM
Hello,
(function executeRule(current, previous /*null when async*/) {
var item = new GlideRecord('sc_req_item');
item.get(current.request_item);
if (item == '3c8f73a7db669f04dc05546adc96194b'){
item.work_notes = current.getDisplayValue('work_notes');
item.update();
}
})(current, previous);
Thanks,
Ali
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:13 PM
Hello Ahmmed,
This solution did not work either unfortunately

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:27 PM
Hello,
Make the BR as before update and try below script with logs.
(function executeRule(current, previous /*null when async*/) {
gs.log("inside","updateBR");
var item = new GlideRecord('sc_req_item');
item.get(current.request_item);
gs.log("inside 2","updateBR");
if (item == '3c8f73a7db669f04dc05546adc96194b'){
gs.log("inside 3","updateBR");
item.work_notes = current.getDisplayValue('work_notes');
item.update();
}
})(current, previous);
also please let me know what values coming in logs.
Thanks,
Ali
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:40 PM
Hi Ahmed,
FYI: This condition will never be satisfied
if (item == '3c8f73a7db669f04dc05546adc96194b'){