- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 06:11 AM
Hi,
We have created catalog item and we have used attachment variable to attach the attachment while creating request in ServiceNow. Once the request is submitted approver is using service portal to approve the request but he is not able to see the attachment which is attached while creating the request. Could anyone help me how to download the attachment from the variable in Service Portal.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2022 09:38 PM
Hi,
Glad to know that my approach worked to show the attachment in portal view.
You can only upload 1 file in attachment variable then how can multiple files be attached?
Your question was around copying the file from attachment variable to approval record for which the solution I shared has worked.
Please mark my response as correct & close the thread so that it benefits future readers.
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
‎07-05-2022 03:16 AM
Hi,
small change
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YY" + current.source_table);
gr.addQuery("table_sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName();
gr.update();
new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
}
})(current, previous);
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
‎07-07-2022 05:05 AM
Hi Ankur,
I am able to get the attachment in the service portal view for the approver. I have uploaded two attachment in the ticket. But i am able to see only one attachment in the service portal. Kindly help me how to get two attachment in the ticket for the approver in service portal view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2022 09:38 PM
Hi,
Glad to know that my approach worked to show the attachment in portal view.
You can only upload 1 file in attachment variable then how can multiple files be attached?
Your question was around copying the file from attachment variable to approval record for which the solution I shared has worked.
Please mark my response as correct & close the thread so that it benefits future readers.
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
‎07-12-2022 09:01 AM
Hi Ankur,
I have two attachment variable in the catalog item form. I would like to see those two attachment in the service portal. Kindly help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2022 06:09 AM
try to use while loop
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YY" + current.source_table);
gr.addQuery("table_sys_id", current.sysapproval);
gr.query();
while (gr.next()) {
gr.table_name = current.getTableName();
gr.update();
new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader