- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
I need to copy my additional comment from RITM to sc_task . But my sc_task contain group type "Restriction" Only user part of sc_task can able to see the sc_task. So, comment is copying properly.
I tried creating an event + BR + script action but it not working
BR: (After - update)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
in after update BR on RITM, no script action required
BR Condition: Comments Changes
(function executeRule(current, previous /*null when async*/ ) {
var sctask = new GlideRecord('sc_task');
sctask.addQuery('request_item', current.sys_id);
sctask.setWorkflow(false); // disables query BR and allows script to query that record
sctask.query();
while (sctask.next()) {
var comments = current.comments.getJournalEntry(1).match(/\n.+/gm).join("\n");
comments = comments.replace('\n', '');
sctask.comments = comments;
sctask.update();
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
you want to copy comment from RITM To SC Task
how does this depend on the Group type for the Group selected on SC Task?
what's not working?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
In sc_task assigment group - group type is "Restricted" only few people are part of the group
E.g If Abel tuter is part of the restricted group if he tries to add comment on RITM it copying to task but if i am not part of the sc_task group but i raised the request as opened by my comment is not copying.
As per catalog item - Item will visible for few people who i am part of it but i am not part of sc_task group.I can see only REQ and RITM .Sc_task will be visible for "Restricted
" group people only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
how is the restriction applied on sc_task?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi @s_nandhini
To Copy Ritm comment to sc_task, I guess following code is enough.
BR: (After - update)
(function executeRule(current, previous /*null when async*/) { var ritmComment = current.comments.getJournalEntry(1); var grSCTask = new GlideRecord('sc_task'); grSCTask.addQuery('request_item', current.sys_id); grSCTask.query(); while (grSCTask.next()) { grSCTask.comments = ritmComment; sc_task.update(); } })(current, previous);
Note: Regarding group type "Restriction" , If the sc_task is restricted via ACLs (e.g., Only Assignment Group can read/write), the business rule might fail to update if the user making the RITM comment is not in that restriction group. To bypass this, you can wrap the task update in setWorkflow(false).
