Print to PDF

pramn
Tera Guru

Team , 

Requirement is  we need to create  UI action in particular table to print the all fields  in the table 

can someone help me ..how i can achive this?

 

4 REPLIES 4

Prashant Ahire
Kilo Sage

Hello @pramn 

Add this script in your UI Action, this will create the PDF of the current record and attach to same

 

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();
action.setRedirectURL(current.getTableName()+'.do?sys_id='+current.sys_id);

 

Please check and Mark Helpful and Correct if it really helps you.Regards,
Prashant Ahire

Thanks Pranshant ..could you please guide me how to create it on workspace ...

need your guidence 

pramn_0-1696501192365.png

pramn_1-1696501241716.png

where I am doing wrong >

Prashant Ahire
Kilo Sage

- Go the table where you want the UI action, click on the additional action, then Click on UI action

- Now Give the name for the UI action.

- check on the form button or form context menu as per your requirement

- now add the script in the script section that i have mentioned above.

- Save the action and test

 

Please mark helpful