The additional comments are not copied from RITM to the catalog task. when commenting from portal.

Thuraka Srinu
Tera Contributor

Hi team, I am facing an issue where the additional comments are not copied from RITM to the catalog task.

when we are putting the comments on the portal. It is copied to RITM, but somehow comments are not copied from RITM to catalog task which were given from the portal. We have written a business rule and checked that it is working fine, but the comments are not copied.

ThurakaSrinu_0-1672906529713.png

If the portal language is English, the comments are getting copied, but if the portal language is different from English, they are not copied.

ThurakaSrinu_1-1672907570276.png

 

This is the Business which we are using

 

(function executeRule(current, previous /*null when async*/ ) {

// To copy "Additional Comments" from RITM to Catalog Task(s)
if (current.u_worknotes_transfer == false) {
var tasksRec = new GlideRecord('sc_task');
tasksRec.addQuery('request_item', current.sys_id);
tasksRec.addActiveQuery();
tasksRec.query();
while (tasksRec.next()) {
if (current.work_notes.changes()) {
var workNote = current.work_notes.getJournalEntry(1);
var workNote2 = workNote.split('Work notes)\n');
var onlyWorkNote = workNote2[1];
tasksRec.work_notes = onlyWorkNote.toString().trim();
}
if (current.comments.changes()) {

var comment = current.comments.getJournalEntry(1);
var comment2 = comment.split('comments)\n');
var onlycomment = comment2[1];
tasksRec.comments = onlycomment.toString().trim();
}

tasksRec.u_worknotes_transfer = true;


tasksRec.update();

}
} else {
current.u_worknotes_transfer = false;
}

})(current, previous);

 

 

Team can you please help us to find the solution. 

 

 

 

5 REPLIES 5

Pato_Herrera
Tera Contributor

Hi @Thuraka ,

We use this script:

-----------------

(function executeRule(current, previous /*null when async*/) {

var tsk = new GlideRecord('sc_task');
var str_comment = current.comments.toString();
tsk.addQuery('parent', current.sys_id);
tsk.addQuery('active', true);
tsk.query();
while(tsk.next()) {
if (tsk.number != current.u_slx_origen){
tsk.comments = current.comments;
tsk.work_notes = current.work_notes;
tsk.u_slx_origen_tarea = 'ritm';
tsk.update();
}
}
current.u_slx_origen='';

})(current, previous);