The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Sohail Khilji
Kilo Patron
Kilo Patron

Generate PDF from UI action

 

Sample code : 

 

You can use the below code in your UI action to generate a PDF.

 

 

function generatePDF(){
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var link='https://dev113064.service-now.com/'; // Replace with  sys_parm to get the instace name 
var url = link+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);
}

 

 

Note:

1. Recommend to use sys_property to build the url.

2. You can use page_view  in URL  for a specfic view of fields using sysparm_view.

 

 

< Previous Post                                                             Next Post >

 

           <<<  Top Articles  >>>

  1. ServiceNow Integration with Splunk
  2. LDAP Integration with ServiceNow
  3. ServiceNow Integration with Veeam
  4. Handling ServiceNow flow errors with a flow
  5. Show parent child incident relationships - display in field message
  6. ServiceNow SSO Logout Error (redirects to logout page) – Reason, Fixes and Cause.
  7. Multi Row Variable set ServiceNow MRVS - Creating - Scripting - Example - Limits
  8. ServiceNow Integration with MAC vendor - Get Mac vendor for the given MAC Address.
  9. How to find Log4j vulnerable severs in ServiceNow Using CMDB Query Builder (SecOps) 
  10. How to Cancel a Long-Running Transaction ServiceNow
  11. Hidden Features for System Administrators
  12. Servicenow RPA - Understanding Attended / Unattended / Skilled Automation Bots
  13. How to Perform Servicenow vCenter Discovery | Discovering VMware using vCenter Discovery 
  14. Set Discovery Schedule name to CMDB Record (via Discovery) 
  15. Step by Step - How to discover Linux Servers in ServiceNow 

 

MF Sohail Khilji | Servicenow Developer /  Consultant.

LinkedIn >   https://www.linkedin.com/in/mf-sohail-khilji/

Comments
RGC9
Tera Contributor

Hi @Sohail Khilji ,

 

I attempted using my PDI URL from the URL section as demonstrated, but haven't had any success so far. Could you help me in elaborating your recommendation "Recommend to use sys_property to build the url" please?

 

Thank you!

 

 

LongC
Tera Contributor

Hi @Sohail Khilji ,it worked perfectly. But can we make it attach to the current record? Thank you.

kumarnaresh
Tera Contributor

I want CDF format is it possible? 

Version history
Last update:
‎02-18-2024 12:12 AM
Updated by:
Contributors