- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2020 07:28 AM
Has anyone created a business rule that will copy the sc task comments to RITM in SP view?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2020 07:39 AM
Hi John,
You need use write a before Update Business rule on Catalog Task table with condition as Additional comments changes which will copy comments to RITM. Something as below should help.
If it is worknotes you using then replace comments in code below with work_notes.
(function executeRule(current, previous /*null when async*/)
{
var com = "Catalog Task Comments for " + current.number + " : " + current.comments;
var v_gRITM = new GlideRecord('sc_req_item');
v_gRITM.addQuery('sys_id', current.request_item);
v_gRITM.query();
if (v_gRITM.next())
{
v_gRITM.comments= "Catalog Task Comments for " + current.number + " : " + current.comments;
v_gRITM.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 07:41 AM
Write a before insert and update business rule with the below code and condition when additional comments changes on the sc_task, it will work.
****************************
(function executeRule(current, previous /*null when async*/ ) {
var taskComments = current.comments.getJournalEntry(1).split(' (Additional comments)')[1].trim();
var ritm = new GlideRecord("sc_req_item");
if (ritm.get(current.request_item)) {
ritm.comments = "Comments from Task:" + "" + current.number + ":\n" +taskComments;
ritm.update();
// ritm.setWorkflow(false);
}
*******************************
Regards,
Nayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2022 06:13 AM
Hello
If i need to both additional comments and work notes how can i write this
and in the comments instead of this i need short description of the task
"Catalog Task Comments for " + current.number