- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:14 AM
Currently I have a BR called Work notes to RITM. This will copy what was put in the task under work notes and pull that up to RITM.
Here is the script:
What do I need to add to the script so additional comments (customer visible) gets copied up to RITM as well?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2017 10:15 PM
Hi John,
Not sure of already got the answer, got some time to do some testing as I promised and here is the test it did:
Type: Business Rule
Table: sc_task
Parameters: Run: Before insert and update
Filter Conditions: Additional comments or work notes changes
Script:
cascadeComment();
function cascadeComment(){
var gr=new GlideRecord("sc_req_item");
gr.get(current.request_item);
gr.work_notes=current.work_notes;
gr.comments=current.comments;
gr.update();
}
And I can see comments and work_notes are updated in activity formatter. Try this and see if this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 12:35 PM
I have removed all additional comments and comments and work_notes that I dot walk.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 01:05 PM
Let me do some testing from my side and I will provide you an update.
Shruti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 03:49 PM
Shruti,
I look forward to seeing if you can come up with a resolution for this.
Thanks,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2017 10:15 PM
Hi John,
Not sure of already got the answer, got some time to do some testing as I promised and here is the test it did:
Type: Business Rule
Table: sc_task
Parameters: Run: Before insert and update
Filter Conditions: Additional comments or work notes changes
Script:
cascadeComment();
function cascadeComment(){
var gr=new GlideRecord("sc_req_item");
gr.get(current.request_item);
gr.work_notes=current.work_notes;
gr.comments=current.comments;
gr.update();
}
And I can see comments and work_notes are updated in activity formatter. Try this and see if this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 04:55 AM
I am using a very similar code to what what you have
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sc_req_item');
gr.get(current.request_item);
gr.comments = current.comments;
gr.work_notes = current.work_notes;
gr.update();
})(current, previous);
But it was causing a lot of slowness. I opened a Hi ticket and they suggested the following:
"In the BR code, you can put a if condition such that if you get undefined then the further check of the records wont go through."
Do you have a suggestion for what code to add to achieve that?