How can I add attachments to change templates?

vimalchandra
Kilo Contributor

Hi ServiceNow community,

I've created change templates however when creating a change request, I would like to attach client change documents to the change request so they are attached automatically.

In the template, I did attempt to attach the document however it did not reflect when creating the change request.

Is this something possible to do in ServiceNow? If so, how can I achieve this?

Thanks,

Vimal

1 ACCEPTED SOLUTION

srinivasthelu
Tera Guru

HI Vimal,



This possible, but requires a Business Rule to be created on Change Request table.



screenshots below:




Capture1.JPGCapture3.JPG




BR code for convenience:



(function executeRule(current, previous /*null when async*/) {




GlideSysAttachment.copy(current.std_change_producer_version.std_change_producer.getRefRecord().getTableName()+'',current.std_change_producer_version.std_change_producer.sys_id+'', current.getTableName(), current.getValue('sys_id'));



})(current, previous);


View solution in original post

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Vimal,



Please refer below thread for reference.


Copy Attachment from Template to Incident


Hi Pradeep,

 

Is it possible to copy attachments from incident record to email client templates when you click on the email button in more options button on the form?

srinivasthelu
Tera Guru

HI Vimal,



This possible, but requires a Business Rule to be created on Change Request table.



screenshots below:




Capture1.JPGCapture3.JPG




BR code for convenience:



(function executeRule(current, previous /*null when async*/) {




GlideSysAttachment.copy(current.std_change_producer_version.std_change_producer.getRefRecord().getTableName()+'',current.std_change_producer_version.std_change_producer.sys_id+'', current.getTableName(), current.getValue('sys_id'));



})(current, previous);


Community Alums
Not applicable

Hi Srinivas -

 

I applied your BR but the attachment seems to attach only on the first save. How can I make the attachment before the first save so that the user has the option to edit the attachment and then re-attach it.

And also two of the same attachments get attached. Can you please help?