- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2021 05:34 AM
Hello,
I am working on an automation process where inputs given in a catalog items are verified and they are used to create a pdf file and send it as an attachment in the notifications.
I have created a workflow to get all the variables and trying to write a runscript to make a pdf file and that file has to be attached and sent.
Any possibility to achieve this via java script.. I dont want to use a powershell custom activity to do this..
Any leads would be helpful.
Thanks,
Andy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2021 06:52 AM
this link has the solution
Generate PDF and attach to the record
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 06:05 AM
Hope you are doing good.
Did my reply answer your question?
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2021 06:42 AM
First you need to define the content of your pdf. If you want the whole form in PDF and want to attach to record then you can use below sample code.
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);
// Create new properties and save user id and password of an admin account
rm.setBasicAuth('admin', 'adminPassword');
rm.saveResponseBodyAsAttachment(current.getTableName(),current.getUniqueValue(),current.number+".pdf");
var response = rm.execute();
Then you can create a notification on the same table and check the include attachment on the notification.
Hope it helps.
Regards,
Ujjawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 05:55 AM
Hi,
If I am able to answer your question then please mark my answer correct and helpful. So that it can be helpful for future readers for same query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2021 07:07 AM
Hi Andrew,
If I helped you to resolve your query with my answer. Then I would really appreciate if you can mark my answer correct and helpful. So that it can be moved to answered list and helpful for future readers.
Regards,
Ujjawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2023 10:32 PM
Thank you,
This was the solution I was looking for.