- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12 hours ago
I have an attachment and i have added via catalog item view and it s available in the RITM after creating a request, but it s not present in the Sctask. How can i bring in Sctask ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
you can use after insert business rule on sc_task to copy attachment from RITM to SC Task
(function executeRule(current, previous /*null when async*/ ) {
new GlideSysAttachment().copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
})(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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi @divyadhanda ,
I tried your problem in my PDI and it is working fine for me please create one OnBefore Business Rule which works when sc_task inserted and add below script
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var ritmId = current.request_item;
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', ritmId);
att.addQuery('table_name', 'sc_req_item');
att.query();
while (att.next()) {
GlideSysAttachment.copy('sc_req_item', ritmId, 'sc_task', current.sys_id);
}
})(current, previous);
Result:
RITM have attachment
Same attachment got attached to sc_task
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
you can use after insert business rule on sc_task to copy attachment from RITM to SC Task
(function executeRule(current, previous /*null when async*/ ) {
new GlideSysAttachment().copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
})(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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Can we use Before insert BR or After insert BR?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
after insert
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10 hours ago
Can we do this catalog item specific? Only for a particular catalog item, this BR should get execute.
