Worknotes need to be added to task when attachement was added to ritm or request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-11-2024 06:53 PM
when we add an attachment to a RITM or request, then in the task a worknotes to be added stating that 'xyz' attachment was added to request or ritm. Can someone help me on this.
thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-11-2024 08:08 PM - edited ā02-11-2024 08:10 PM
Hello @Ak8977 ,
You can write After insert business rule on sys_attachment table. Please find the below sample script and screen shots
(function executeRule(current, previous /*null when async*/) {
if(current.table_name == 'sc_req_item'){
var ritmSysId = current.table_sys_id; // RITM record's sys_id
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',ritmSysId);
gr.query();
if(gr.next()){
gr.work_notes = current.file_name + " attachment added to "+gr.number;
gr.update();
}
}
})(current, previous);
You can customize the script according to your requirement,
Please mark my answer helpful & correct, if it helps you
Thank you
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-11-2024 09:42 PM
I want to update the worknotes in task when attachment is added to request or ritm.
Not to update the worknotes in ritm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-11-2024 09:58 PM
Hello @Ak8977 ,
Then you can glide sc_task table with the RITM sys_id, you can change above script according to your requirement.
Please mark my answer helpful & correct, if it helps you
Thank you
Thank you
G Ramana Murthy
ServiceNow Developer