How to get the image to script include and convert to PDF to generate the image in letters

Amit Rao
Giga Expert

How to get the image that is stored in db_image table and then generate the letters which contains that image.
The image is a Signature and we have created a M2M mapping table to get the sys id of the image , this is done successfully using Glide record.

Note :- Field 'u_siganture_image' is the backend name of 'Signature image' field which is referenced to db_image table.

find_real_file.png

var m2m_table = new GlideRecord('sn_hr_core_gepi_m2m_mapping');
m2m_table.addQuery('u_data_type', 'Attachment');
m2m_table.setLimit(1);
m2m_table.query();
if (m2m_table.next()) {
attasys_id = m2m_table.u_siganture_image.toString();
gs.info('Attachment sys_id ' +attasys_id);
}

After getting the sys id that need to be passed in the variable  which is called in 'HR Document template' table to generate letters.

find_real_file.png
Below code is written to pass the image 'Signature.jpg' to the variable 'Signature_image' but it is not working.

Please help!

parsedBody = parsedBody.replace(/\$\[Signature_Image\]/gi, '<p><span style="font-family: verdana, geneva; font-size: 8pt;"><img src="Signature.jpg" width="539" height="268"/></span></p>');

Name of the image  is 'Signature.jpg'

4 REPLIES 4

Amit Rao
Giga Expert

@Ankur Bawiskar 

@Aman Kumar 

@Jaspal Singh 

@Allen Andreas 

@Mark Roethof 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

that signature image has some characters which you want to fetch?

Can you share screenshot for better explanation?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar 

Here is the screenshot. So idea is to add this signature to pdf. You may check the content in main question for more detail.

find_real_file.png

Hi,

I didn't get your requirement actually.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader