We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to pre populate attachment variable inside record producer

Alon Grod
Tera Expert

Hi,

I create a Record Producer and one of the variables is of type Attachment. I would like to pre populate this variable with a pdf file and to have a digital signature underneath, is it possible ?

2 REPLIES 2

Kieran Anson
Kilo Patron

Hi,

Yes this is possible by specifying the sys_id of the sys_attachment record as the default value for the variable 

Tanushree Maiti
Tera Patron

Hi @Alon Grod 

 

Yes, it is technically feasible. You just need to create a onload client script and script include , write this function.

populatePdf: function() {

        var SysId = this.getParameter('<sys_id of record>');

        var attachPDFSysId = "";

        var grAttachment = new GlideRecord('sys_attachment');

        grAttachment.addQuery('table_name', '<table_name');

        grAttachment.addQuery('table_sys_id', SysId);

        grAttachment.query();

        if (grAttachment.next()) {

            attachPDFSysId = grAttachment.sys_id.toString();

        }

        return attachPDFSysId;

    }

 

Note: For adding digital signature , you need to add additional script.

 

Refer: 

Digital signature for PDF documents using CAC or PIV smart cards 

How to add Digital Signature in PDF through Script

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti