PDF Attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I am looking to attach a PDF to the Transfer Order Line Task (specifically the shipping line task). This document, once filled out and the Transfer Order Line Task is closed, must then be transferred to the received line task. I've never dealt with PDF attachments before so I am not sure how to approach this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
So it's a static file which agent will add to Transfer Order Line Task?
if yes then you can use after business rule on Closure of Transfer Order Line Task and use GlideSysAttachment.copy() logic to copy it to whichever record you want.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Below is the script I used and it worked, however, it is attaching the PDF to every task. I only want it to attach to the task when the stage is in "In Transit". The commented out portion (line 2) is how I tried to do this but when I add it in, it doesn't do anything except PDF doesn't attach at all. When I comment that out, the PDF attaches to every task.
This business rule is on the alm_transfer_order_line_task
(function executeRule(current, previous /*null when async*/) {
// if (String(current.getValue != ('stage') || '') != 'in_transit') return;
var gr = new GlideRecord("sys_properties");
gr.addQuery("name", "order.transfer.pdf.holder"); // name of property in query
gr.query();
if (gr.next()) {
new GlideSysAttachment().copy('sys_properties',gr.getUniqueValue() , current.sys_class_name, current.getUniqueValue());
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago