Duplicate comment getting added

Diksha_Tiwari 1
Tera Contributor

Hi Folks,

 

So I want to add 2 comments to a case from a script include. Below is the code:

 

 var reason = "Does not satisfy the project activities";
 var comment = "test NOTA comment";
 var taskGr1 = new GlideRecord('sn_wsd_case_workplace_case');
 taskGr1.addQuery('sys_id', 'caseSys_ID'); // sysID of case
 taskGr1.query();
 if (taskGr1.next()) {
     if (comment.toString() !== '') {
         taskGr1.comments = reason.toString() + '-' + comment.toString();
         taskGr1.close_notes = reason.toString() + '-' + comment.toString();
     }
     taskGr1.variables.snc_reason = reason.toString();
     taskGr1.comments = "Workplace team selected 'None of the Above' from space option.";
     taskGr1.comments = "Comment 3";
     taskGr1.update();
 }
 
Output of above is coming as below:
Diksha_Tiwari1_0-1739190104649.png

 

One additional comment is getting added , which is combination of below three comments which I am adding separately. How can I fix this? I don't want the combined comment.

 

Any suggestion would be appreciated!.

 

Thanks & Regards.

Diksha