- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2022 06:38 AM
Hi Singh,
Business rule:
(function executeRule(current, previous /*null when async*/ ) {
var compare, task_comment2, task_comment, ritm_comment2, ritm_comment;
task_comment = current.comments.getJournalEntry(1);
//Remove timestamp and name from additional comment
var regex = new RegExp('\n');
var i = task_comment.search(regex);
if (i > 0) {
task_comment2 = task_comment.substring(i + 1, task_comment.length);
}
var ritm_gr = new GlideRecord('sc_req_item');
ritm_gr.addQuery('sys_id', current.parent);
ritm_gr.query();
if (ritm_gr.next()) {
ritm_comment = ritm_gr.comments.getJournalEntry(1);
//Remove timestamp and name from additional comment
var i1 = ritm_comment.search(regex);
if (i1 > 0) {
ritm_comment2 = ritm_comment.substring(i1 + 1, ritm_comment.length);
}
compare = task_comment2.indexOf(ritm_comment2);
if (compare == -1) // If No match found
{
ritm_gr.comments = "ScTask Comments for " + current.number + " : " + task_comment2.trim();
ritm_gr.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2022 05:33 AM
Hi,
are you saying you don't want email only when the comments are copied from sc_task to RITM but require when normal comments are added?
I believe for copying you must have done GlideRecord update on RITM.
In that you can use setWorkflow(false) to disable notification.
Note: Using setWorkflow(false) will block all BRs from running on update of RITM
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2022 06:31 AM
Hi Ankur,
By using setWorkflow(false); its working fine , But I have Issue on setWorkflow(false); additional has not coping from sctask to Ritm .
Additional Comments are has to copy and email has not to trigger while coping the comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2022 06:33 AM
Hi,
BR is written on sc_task right to copy comments to RITM
So I didn't get what's the issue
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2022 06:37 AM
Hi
Comments has to copy from Sctask to Ritm , But email has not to trigger while coping the comments.