Export to PDF UI Action

abhijats
Tera Expert

Hi Everyone,

Can you please tell me how to create a UI Action(Export to PDF) on ESS Portal for exporting the form(UI Page) in PDF Format, Actually we have to give functionality to user to extract the form from ESS Portal related to certain category and then use it in PDF Format.

27 REPLIES 27

Jonathan, thank you very much for your response and excuse my feeble skills.   I did know I was crossing server and client scripting but I had no clue how else to do it.     When I look at your code it seems like it has everything it needs, but when I create the UI Action (client unchecked) it fails.



It appears to have something to do with this line.



rm.saveResponseBodyAsAttachment(current.getTableName(),current.sys_id,fileName);


I changed fileName to current.number, and that seems to allow that line to work however it still doesn't create the file.



the execute is returning response = 0... which in my experience is good... but it doesn't seem the case here.


I really appreciate your help on this.


Brian


Jonathan,


I still don't understand how to use this REST example.


It seems like the endpoint needs to be more than the table name, but when I provide more than that I get a 401 not authorized error.     The way it is the execute still gets a response of '0'.   I don't think that is even a valid REST response.



rm.setEndpoint(current.getTableName()+ '.do?PDF&sys_id=' + current.sys_id);



Thank you


Brian


Thanks a lot Jonathan.



it is working good,

here i have one concern ,

while downloading into PDF, can we add logo on top of the report ?

Robert_Cartwrig
Tera Expert

You asked for a UI Action to export to PDF from the portal.   I just wanted to chime in that exports from table widgets is a native functionality.   You don't need a UI Action to do this (though you may have a business requirement to create it).



If this fits the need, just left-click on the hamburger in the upper left hand corner of the widget in the portal and you'll see options to export to PDF, Excel, and CSV.   To allow ESS users to be able to successfully export, you may need to adjust a couple of ACLs.



For PDF and Excel, take a look at the ACL "HTTPAuthProcessor."   For CSV it would be "CSVProcessor."   ESS users have mandatory roles in CSM, so you can use snc_internal if it is intended for internal users only or snc_external if you use it.   If you want it to be open to all, use the "public" role.



Also, check for scripting under the Required Roles as it may be contrary to the required role.   You could alter the roles in the script, or just remove the script entirely and use the actual Required Roles.



Regards,


Robert