Copy Attachments from attachment variable in RITM to Catalog item form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 03:47 AM
Hi,
Here I'm stuck with an issue, that I want copy Attachment from Attachment variable in RITM table to Catalog item form using UI Action. I have tried with this script and I'm not getting any output.
GlideSysAttachment.copy('ZZ_YYsc_req_item',sourceSYSID','sc_cat_item',sys_id=targetSYSID');
var count = 0;
var gsa = new GlideSysAttachment();
var att = new GlideRecord('sys_attachment');
att.addQuery('table_name', 'ZZ_YYsc_req_item');
att.addQuery("table_sys_id", current.sys_id);
att.query();
When I click the refill button it should redirect to the catalog item and the Attachment which stored in attachment variable should paste in the catalog item form
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2022 03:26 AM
Hi,
your question was for copying the file and not for redirection.
Can you explain UI action is on which table?
If it's on RITM table then update as this
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YY" + current.getTableName());
gr.addQuery("table_sys_id", current.sys_id);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName();
gr.update();
new global.VariableUtil().copy(gr.sys_id, current.getTableName(), current.sys_id);
}
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
08-19-2022 05:18 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader