- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 03:26 AM
How to create pdf file by using UI action button(GeneratePDF) for incident record and same pdf attached to same record
---> Create UI action button called GeneratePDF on incident form
----> when click the GeneratePDF pdf file will be generate
---->pdf file will be attached to same incident record
Could you please provide solution with scripting
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 10:11 AM - edited 05-08-2023 10:12 AM
Hi @Brahmi Pandla ,
Create a UI action similar to below
Then Enter below code in the script section of UI action
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('account_id', 'account_password');
rm.saveResponseBodyAsAttachment(current.getTableName(), current.sys_id, current.number + ".pdf");
var response = rm.execute();
var httpResponseStatus = response.getStatusCode();
gs.log(httpResponseStatus);
Ensure that you create a user account and enter the id and password for the user account in the 5th line of code.
Optional - Feel free to replace 5th line with below line after setting up 2 system properties, a username and a password that correspond to a user account that is used to generate the PDF.
rm.setBasicAuth(gs.getProperty('pdf.export.username'), gs.getProperty('pdf.export.password'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 05:33 AM
hii maybe you can tell me where i can find the PDF that created?