- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2014 11:11 AM
I want to add a close button to my form. In case the user is populating the form and figures out, they really don't need to. I just want it to just exit the form and take them back to the list of records.
So I created a UI Action and put the following script it.
action.setRedirectURL(current);
It is not working correctly.
On the same note, is it possible to create a UI Action that will Export to PDF?
Instead of the user having to right clicking the header > Export > PDF. It would be much nicer if they can just click a button.
Thanks in advance for any guidance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2014 12:03 PM
Include in your UI Action a call to setAbortAction and use setRedirectURL to the list you want.
current.setAbortAction();
action.setRedirectURL("incident_list.do");
Using setRedirectURL this way will force the user to go back to the list you want, whereas setRedirectURL(previous) will send them back to whatever form/list they were. It depends on what you're trying to achieve.
As for the Export to PDF button. Try creating a UI Action as follows:
Name: Save as PDF
Active: True
Show insert: false
Show update: true
Form button: true
Script:
action.setRedirectURL('incident.do?PDF&sys_id=' + current.sys_id + '&sysparm_view=ess');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2014 11:32 AM
Hi James,
I think probably you might need to use action.setRedirectURL(previous);
On clicking the UI Action, the User will be Navigated to the Page from where he came to the Current Page.
For the 2nd Part of your requirement, you can take a look at the Develop Community as there you might find your answer.
Thanks,
Subhajit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2014 11:34 AM
Hi James,
You may find the below thread as helpful
Custom PDF Files in ServiceNow through PDFCrowd-John James Andersen
Thanks,
Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2014 12:03 PM
Include in your UI Action a call to setAbortAction and use setRedirectURL to the list you want.
current.setAbortAction();
action.setRedirectURL("incident_list.do");
Using setRedirectURL this way will force the user to go back to the list you want, whereas setRedirectURL(previous) will send them back to whatever form/list they were. It depends on what you're trying to achieve.
As for the Export to PDF button. Try creating a UI Action as follows:
Name: Save as PDF
Active: True
Show insert: false
Show update: true
Form button: true
Script:
action.setRedirectURL('incident.do?PDF&sys_id=' + current.sys_id + '&sysparm_view=ess');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2016 06:12 AM
Hi Amado
I have been trying the same thing on my custom application and have gotten further after your answer, however, I am trying to export and replaced the 'incident.do' with my table name. I get the option to open and save the pdf, however, it does not take out any data from my form.
action.setRedirectURL('x_pfgb3_dev_a_te_p_dev_a_te_production_issue_table?PDF&sys_id=' + current.sys_id + '&sysparm_view=ess');
If I use the 'incident.do' it will export the incident form.
Thank you in advance for taking a look