Document Templates for RITM's

Nagashree5
Tera Contributor

Hi All,

 

I have created a HTML document template which is a PDF. The document is not stored in the attachment table, it is in sn_doc_template table in the form of template written on the Custom RITM table. Every time the template consumes the variable values of a RITM.I would like to attach this template to the RITM whenever a particular form gets submitted.

Can anyone suggest how we can achieve this.

 

Thanks in Advance.

7 REPLIES 7

If I understand the situation correctly, you have a record in table sn_doc_html_template and you want to inject data into the template, from requested items and attach the resulting PDF to those same requested items.

In that case the PDF is generated and attached by calling method generate of Script Include sn_doc.HtmlTemplateUtils.

That call will do that: take data from the requested item, inject it into the template as defined in the template and will attach the resulting PDF to the source requested item record.

The PDF that has been generated from the HTML Template record is a static sample, there is not much you can do with it in this scenario.

-O-
Kilo Patron
Kilo Patron

Something like

new sn_doc.HtmlTemplateUtils().generate('<sys_id of the Task>', '<sys_id of the HTML Template>', '<the name of the resulting PDF file/attachment>');

This returns an object that looks like:

{
	"attachment_id",
	"message",
	"request_id";
	"status"
}

property message will contain a human readable text as to what happened or went wrong, request_id is an internal job ID and status indicates whether generating was successful or not.

G Sai Vamshi
Mega Guru

Hi @Nagashree5  Did you found the solution?? I have similar requirement, it would be helpful if you can share the solution.