Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Export Button on the WORKSPACE FORM, that downloads/exports the PDF of the record

krgss
Tera Contributor

Hi guys,

 

I have a form of a table record in a WORKSPACE, on which I need a button to export the record to PDF format and download it.

I know we have url that helps to export the record to PDF (url is https://<instance_name>.service-now.com/<table_name>.do?PDF&sys_id=<Sys ID of the record>&sysparm_view=<Form View>),

but how do I hit that link from the button ? or any other way using UXF Declarative Action and Event Mapping and Event Handler ?

 

I tried with a UI Action with action.setRedirectURL(url) that never worked for the workspace).

 

Any help is appreciated. Thanks!

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could do this with a button in UIB that uses the link to destination event to open the pdf view in a new browser tab. Check out this post on how to redirect to a non-workspace link: https://www.servicenow.com/community/developer-forum/how-to-pass-a-parameter-to-an-link-to-destinati...

You should also be able to do this with a declarative action that fires an event and uses the same event handler, but the UIB button component seems simpler.

View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could do this with a button in UIB that uses the link to destination event to open the pdf view in a new browser tab. Check out this post on how to redirect to a non-workspace link: https://www.servicenow.com/community/developer-forum/how-to-pass-a-parameter-to-an-link-to-destinati...

You should also be able to do this with a declarative action that fires an event and uses the same event handler, but the UIB button component seems simpler.

But I need the button on the Record Page Component, so shouldn't we take the route of UI Actions/UX Form Actions ?

Brad Tilton
ServiceNow Employee
ServiceNow Employee

If you want it in the action bar it'll need to be a declarative action, otherwise you can just put it somewhere on the page from UIB. Just depends on where you want it.