Excel attachment is not getting attached while template is applied

Pallavi65
Tera Contributor

Hi everyone,

 

I have created a template (not standard change template) on Change Request table. In that there is an excel file I have attached to that template. But when I applied that template the values are populating but the attachment is not getting attached to the change request. 

Can someone tell me how can I achieve this?

 

 

Regards,

Pallavi

2 REPLIES 2

Murthy Ch
Giga Sage

Hi @Pallavi65 

The attachment won't be added.

Recently I have answered this question. Please go through the below link:

https://www.servicenow.com/community/it-service-management-forum/how-to-copy-attachment-from-sys-tem... 

Hope it helps.

Thanks,
Murthy

Hello Murthy,

 

I have used the same code, but it has not worked for me. 

So, when a template is applied to a change request, then the short description will change to something. So, I have written a on Change CS on the field short description but it's not working:

Please note I have created one more type on CR and using this, it's not Normal, Standard or Emergency

My Code:

on Change CS:

if(type == 'test'){

if(isTemplate && newValue == 'Test request'){

var ga = new GlideAjax('SInclude');

ga.addParm('sysparm_name','fnc');

ga.addParm('sysparm_attach',newValue);

ga.getXML(answer);

}

function answer(response)

{

}

................................................................................................................................................

and in Script Include:

 

GlideSysAttachment.copy('sys_template','here given the sys_id of the template','Change_request',this.getParameter('sysparm_attach'));

 

 

So please help

 

 

Regards,

Pallavi