Utilize the Document Templates for RITMS

Nagashree5
Tera Contributor

Hi All,

 

I have created a HTML document template which is a PDF. 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.

 

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Nagashree5 You can create an onBefore Insert business rule on RITM table and in condition builder apply a check of Item (cat_item) to only trigger when a particular catalog item is submitted.

 

In the script, you can use GlideAttachment API to copy the attachment to the target record. Please make the appropriate changes in the following script for the same.

 

var attachment = new GlideSysAttachment();
var incidentSysID = 'ab1b30031b04ec101363ff37dc4bcbfc';
var incGR = new GlideRecord('incident');
incGR.get(incidentSysID);

var copiedAttachments = attachment.copy('incident', incidentSysID, 'problem', incGR.getValue('problem_id'));
gs.info('Copied attachments: ' + copiedAttachments);

Hope this helps.

Hi @Sandeep Rajput,

 

The document is not stored in the attachement table, it is in sn_doc_template table in the form of template written on the RITM table. Every time the template consumes the variable values of a RITM.

 

Please suggest.