- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 10-16-2020 05:27 AM
The following are business rules we use to copy work notes and comments from the request task to the parent requested item record. Hopefully these will be useful for other folks as well...
//Name: Copy comments from TASK to RITM
//Table: sc_task
//Advanced: true
//When: Before Update; Additional Comments <changes>
//Condition: current.comments.changes() && current.comments.indexOf('Comment added from:') < 0;
// Note that the condition prevents the note from copying multiple times.
//Script:
(function executeRule(current, previous /*null when async*/) {
if(current.comments.nil()){
return;
}
else {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.request_item);
gr.query();
while(gr.next()){
gr.comments = "Comment added from: " + current.number + " | " +current.request_item.cat_item.name + "\n >>> " +current.comments;
gr.update();
}
}
})(current, previous);
//Name: Copy work notes from TASK to RITM
//Table: sc_task
//Advanced: true
//When: Before Update; Work Notes <changes>
//Condition: current.work_notes.changes() && current.work_notes.indexOf('Work Note added from:') < 0;
// Note that the condition prevents the note from copying multiple times.
//Script:
(function executeRule(current, previous /*null when async*/) {
if(current.work_notes.nil()){
return;
}
else {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.request_item);
gr.query();
while(gr.next()){
gr.work_notes = "Work Note added from: " + current.number + " | " +current.request_item.cat_item.name + "\n >>> " +current.work_notes;
gr.update();
}
}
})(current, previous);
Cheers !
- 9,748 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi John,
I have requiremnt for,
Roll up of work notes from sub-task to task
Roll up of work notes from task to sub-projects
Roll up of work notes from sub-projects to the master projects
Identifier of rolled up work note that which task/sub-tasks or sub-project it actually belongs to.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi ,
If we use above script for after Business rule, we face any issues?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @somasekharK
We did something like that. Because fulfillers work on the SCTASKs and most of them don't like to jump up to the RITM to read any additional information added by user from Service Portal.
So, we had to create 2 Business Rules, one on the RITM (to copy comments to the SCTASK) and another in the SCTASK to copy comments to the RITM.
But must be careful, otherwise it get duplicating easily.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hey, do you have a script that would work with adding comments from an Approval record to the parent RITM?
These scrips worked for me and anything I am finding related to this is not working. I wonder if it is possible how we have our approval process setup?