- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 05:50 PM
Here's the requirement I'm trying to achieve:
When a Change Request is created it's automatically populated with a word document attached (but it has a unique ID).
For example I have a "request for change" questionnaire document template.
Each time a change is created I want this document to be attached to the change but only associated with this change request.
The Change Owner will edit the document and fill in the information for this specific change. Ideally the filename should contain the
change record ID number like <CHG12345> Request for Change
Any thoughts on how best to do this? Ideally we want to do this with configuration and not customization if possible.
Thanks,
Kristin
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 12:50 PM
Hi Kristen,
Instead of a "template template", just pick some random record to hold the original attachment. It doesn't even need to be a change record. Let's say for sake of argument that it's on the sys_user record for 'guest' (we'll also pretend that record has a nice easy sys_id of 0123456789ABCDEF.
Now you just need an AFTER business rule on the change request table that looks something like this:
Name: Copy sample doc
Active: true
Insert: true
Update: false
When: After
Condition: (empty)
Script:
(function executeRule(current, previous /*null when async*/) {
GlideSysAttachment.copy('sys_user', '012345679ABCDEF', 'change_request', current.getValue('sys_id'));
})(current, previous);
//Untested

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:29 PM
Hi Kristin,
When you create the new change request, use an after business rule to create a copy of the attachment (you'll have to upload an initial template somewhere.)
The key to making this happen is GlideSysAttachment.copy(). You can find more details and example here:
Copy Attachments from Record to Record - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2020 12:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2020 05:48 AM
I was with you until the end. If the user is downloading a file and editing it, when they upload, they are going to be uploading a new file. There's no current way to "replace" the existing upload by default. You would need to build some logic to say "Hey, that file has the same name" or "Here comes an attachment, let's automatically delete the existing attachment(s)". Both of those sound really scary to me. It sounds like you might be getting in to functionality found in the Employee Document Management plugin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2020 07:18 AM
Hello Chuck,
Thanks for your response,
I have installed plugin in personal instance, i have no idea how to use this
Employee Document Management for my requirement.
Thanks in advance!
Regards,
RDK.