logo

NJP

Copying Attachments from a Record Producer's Attachment Variable to a Target Record in ServiceNow

New article articles in ServiceNow Community · Jan 23, 2025 · article

Often, there's a need to copy attachments from a record producer's attachment variable to the target record. Unfortunately, there's no direct out-of-the-box solution for this in ServiceNow.

However, you can achieve this by using the record producer script. Here's how you can do it:

// pass the attachment variable name // pass the target table name associated with the record producer new global.VariableUtil().copyAttachment(producer.,'', current.sys_id); // repeat this line again for another variable if required

Output Comparison: Native and Portal

When running the script, here's the output you can expect in both the native and the portal:

copy attachment variable to target record.gif

View original source

https://www.servicenow.com/community/service-operations-workspace/copying-attachments-from-a-record-producer-s-attachment-variable/ta-p/3157266