- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2021 08:42 PM
How to copy attachment from sys_attachment table to a field of file attachment type in a custom table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 01:05 AM
Hi,
then the same script can be used to update the attachment field
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', current.sys_id);
att.query();
if(att.next()){
current.attachment_fieldName = att.sys_id;
current.setWorkflow(false);
current.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 12:54 AM
hi Ankur,
it is not working.Actually i have used after insert BR because first pdf should get automatically attached to the record after submitting the record only after that i could take the atachment from sys_attachment table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 01:05 AM
Hi,
then the same script can be used to update the attachment field
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', current.sys_id);
att.query();
if(att.next()){
current.attachment_fieldName = att.sys_id;
current.setWorkflow(false);
current.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 01:24 AM
Still its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 01:34 AM
Hi,
it worked for me
your BR is on which table and please share complete BR script and BR configuration image
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 01:56 AM