Generate a pdf name using UI action from catalog variables

Vamshi_ch123
Tera Contributor

Hi All 

 

I have created a Button called print on the request item table so when a user clicks on it this will generate a pdf as sc_req_item(1) but now I want to replace the name with the Name of the variable from the catalog item using below script.

Script:

function exportPDF() {
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var a='https://xxx.service-now.com/';
var url = a+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);
	} 

Vamshi_ch123_0-1690951389882.png

 

 Thank you

 

 

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Vamshi_ch123 

since you are using the OOB way to generate the pdf you can't change the file name

You can use custom code for this

Check this link

Generate PDF and attach to the record 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Anil Lande
Kilo Patron

You can try below solution, it will attach the generated PDF to your record and set the name of file as per your requirement.

https://www.servicenow.com/community/developer-articles/generate-pdf-and-attach-to-the-record/ta-p/2...

 

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande