PDF Attachment not comes from HR template to HR task

abirakundu23
Mega Sage

Hi All/ @Anil Lande /@Ankur,

We want attach pdf documents on HR task for end user. so we use following approach. I have attach a pdf on HR template ,from this attachment comes to HR task.

We want to copy pdf attachment from HR template to HR task. Wrote After/insert BR on task table as per article.

Can we copy attachments from HR templates to HR task form ? - Human Resources Service Delivery - Que...

After/insert BR

==============

(function executeRule(current, previous /*null when async*/) {
gs.addInfoMessagedd("Hello pdf in  task");
GlideSysAttachment.copy('sn_hr_core_template',cfde0ab387685d5463c853973cbb35e6, 'sn_hr_core_task', current.sys_id);

})(current, previous);

Pdf attachment not comes up.

 

5 REPLIES 5

abirakundu23
Mega Sage

Hello All/ @Jaspal Singh / @Mohith Devatte ,

Could you please look into this ?

 

@absnow  hey ,

i think there is a typo in the gs.addInfoMessagedd("Hello pdf in  task");  it should be gs.addInfoMessage("Hello pdf in  task"); 

This might stop the script execution at this line we never know so please correct it and try below code for copying the attachment

var copyAtt = new GlideSysAttachment();


copyAtt.copy('sn_hr_core_template','cfde0ab387685d5463c853973cbb35e6', 'sn_hr_core_task', current.sys_id);

Please mark my answer correct if it helps you

Hello @Mohith Devatte ,

We got log message but info message is not display and attachment not comes up in HR task from HR template. Could you please guide ?

Attachment not attach on HR task. But we got all the log and info message.

could you please tell me the reason of not attachment comes up ?

hello @absnow  as mark said please enclose the sys_id in string like below

var copyAtt = new GlideSysAttachment();


copyAtt.copy('sn_hr_core_template','cfde0ab387685d5463c853973cbb35e6', 'sn_hr_core_task', current.sys_id);