attachment in approval notification

gbade
Kilo Contributor

I have a requirement to attach a document to notification email but include attachment feature not working.

Basically, I need the attachment to show in the approval notification email the approver gets. In my workflow for requested items, I have a task where an itil user has to attach a document for review by the approver. when the task is closed, an approval request is generated. so when the approver gets the email, I want the attachment to show in the email.   Most of the approvers are not itil users so they need to be able to see this in an email. tried the include attachment feature in notification but it doesn't work. pls see below. not great with scripting so need some assistance pls.

find_real_file.png

1 ACCEPTED SOLUTION

Hi,



If the attachment is uploaded on requested item, you don't need getTaskId(). I assume your notification is created on the Approvals table (sys_approval_approver). Change the following line in the above code and I think you should be all set.



var gr = new GlideRecord('sys_attachment');


gr.addQuery('table_sys_id', current.sysapproval.sys_id);   // current.sysapproval field should have the requested item object.


gr.query();




Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response.


View solution in original post

9 REPLIES 9

gbade
Kilo Contributor

Hi AliKutty,


Please can you explain   this function. do I include it in the mail script?


function getTaskId(){


      //Get the sys_id of your task by dot walking from approval record (current.sysapproval) to get the requested item and then the related task


      // Or


      // Pass it as a parameter if the email is triggered via event


}



Thanks


gbade
Kilo Contributor

the attachment is added to the requested item, not the the   task.   the assignee   attaches the task to the requested item then closes the task.


Hi,



If the attachment is uploaded on requested item, you don't need getTaskId(). I assume your notification is created on the Approvals table (sys_approval_approver). Change the following line in the above code and I think you should be all set.



var gr = new GlideRecord('sys_attachment');


gr.addQuery('table_sys_id', current.sysapproval.sys_id);   // current.sysapproval field should have the requested item object.


gr.query();




Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response.


gbade
Kilo Contributor

Thank you very much. it worked !!!!!!


Hi,



Please mark the answer as correct so others can refer and we can close this thread.



How To Mark Answers Correct From Community Inbox




Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response