Need add attachments when record producer is submitted
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello All,
I have a record producer created on the dmn_demand table. When user submits the record in ESC portal, on demand record, i need to attach one excel file. This should happen to each demand requet.
Is this feasible in servicenow, if yes then please let me know how to do it?
Thank you
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
You can attach an Excel file to each Demand record created via the record producer using a few different approaches depending on your requirement.
Option 1: Attach a Static Excel File
If the same Excel file needs to be attached to every Demand:
- Upload the Excel file once (for example, on any record or store its
sys_id) - Use a Business Rule (After Insert) on
dmn_demand - Copy the attachment using GlideSysAttachment
Sample Script:
(function executeRule(current, previous) {
var sourceSysId = 'PUT_SOURCE_RECORD_SYS_ID_HERE'; // record where file exists
var gsa = new GlideSysAttachment();
gsa.copy('dmn_demand', sourceSysId, 'dmn_demand', current.sys_id);
})(current, previous);
var sourceSysId = 'PUT_SOURCE_RECORD_SYS_ID_HERE'; // record where file exists
var gsa = new GlideSysAttachment();
gsa.copy('dmn_demand', sourceSysId, 'dmn_demand', current.sys_id);
})(current, previous);
Option 2: If User Upload is Needed
If the requirement is for users to upload:
- Add an Attachment variable in Record Producer
- It will automatically attach to the Demand record
