Generate PDF document for each change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 06:32 PM
I would like to
1. to generate PDF view of object/records (It happens to be a Change requests https://xyz.service-now.com/change_request.do) and then send that PDF file to an email address and schedule this job for all changes those are approved this week.
2. to generate PDF view of object/records (It happens to be a projects...https://xyz.service-now.com/pm_project.do) and then send that PDF file to an email address and schedule this job for all Work In progress.
I am able to generate PDF using &PDF at the end of URL for each record, but seeking help to automate that for each record that meets criteria.
Any thoughts or ideas how I could accomplish this?
Hari

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 06:45 PM
Hello Hari,
You can use below code in your Business Rule as per your conditions (for example: when changes get approved) , this will attach the Form view with your task and then you can trigger an Email notification with attachment included.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var rm = new sn_ws.RESTMessageV2();
rm.setHttpMethod('GET');
var url = gs.getProperty("glide.servlet.uri") + current.getTableName()+ '.do?PDF&sys_id=' + current.sys_id;
rm.setEndpoint(url);
rm.setBasicAuth(gs.getProperty('glide.user.userid'), gs.getProperty('glide.user.password'));
rm.saveResponseBodyAsAttachment(current.getTableName(), current.sys_id, current.number +".pdf");
var response = rm.execute();
})(current, previous);
Note: you need to define glide.user.userid and glide.user.password in you system properties.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 08:44 PM
Thanks.
Any ideas for how to make this recurring report to show one pdf per project/Change requests for all projects/change requests that meet criteria?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2018 08:06 AM
Hi Shishir
Thanks for posting this, Im getting stuck on defining the glide.user.userid and glide.user.password system properties. What values are we to be entering here?
Many thanks
Steve

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 08:47 PM
Have you thought about creating a report containing the change requests that you are interested in and scheduling it?
Scheduling and Publishing Reports - ServiceNow Wiki