AddAttachmentFromTemplate
AddAttachmentFromTemplate() function adds an attachment created on the given template to the current case. It may also add the created attachment to the given document-type field on the form.
Syntax
AddAttachmentFromTemplate(templateName,fileName,[fieldName]);
Function arguments
- templateName – (String) a name of the template file;
- fileName – (String) a name of the resulting file;
- fieldName – (String) [Optional] a name of the document-type field to which an attachment will be assigned.
Return value
This function returns Boolean.
Returns true if attachment was created, otherwise returns false.
Examples
Example 1:
This will create a document based on the „Contract.docx” template. A name of the created document will be combined from the text „Contract_” and a value of „Number” field on the case form. Then the document will be added to the case attachment list. The template file has to be configured to create the PDF file so the result will be PDF file.
AddAttachmentFromTemplate("Contract.docx","Contract_"+[Number]+".pdf");
Example 2:
This will create a document based on the „Contract.docx” template. A name of the created document will be combined from the text „Contract_” and a value of „Number” field on the case form. Then the document will be added to the „Contract” document-type field on the case form.
AddAttachmentFromTemplate("Contract.docx","Contract_"+[Number]+".docx","Contract");