Adding attachments to templates

stevelucas
Kilo Expert

Hi

Does anyone know of a way to add an attachment to a template so when the template is used the attachment is also added to the change, incident etc?

Thanks

9 REPLIES 9

anurag92
Kilo Sage

SO there would be some code to copy values from Template to Change record.



Add an attachment in the Template



Now add: GlideSysAttachment.copy('sys_template', 'template's sys_id', 'change_request, 'current.sys_id');



Basically, GlideSysAttachment.copy is a function that copies attachment from 1 record to another.



Mark helpful if it helped or correct if answer is correct


Hi Anurag



Sorry not a developer type.


We have a UI action called "Apply Template"



This is the code and I have added in the line from your last response


I guess I am doing something wrong


find_real_file.png


Any thoughts?



Thanks Steve


Hi Anurag



Sorry I think even I was being a bit dim here.



I have modified the line to look like



    GlideSysAttachment.copy('sys_template', 'sys_template.sys_id', 'change_request', 'current.sys_id');



I have added to the apply template script shown above but it does not seem to be copying the attachment to the change request when I apply the template.


It does save OK now.



Thanks Steve


Thanks Kalai


I will check these out ASAP.