- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 10:12 AM
I am trying to add a UI Action button called "Cancel" on a new form (insert). I've tried this code below in the UI Action, but when the user clicks the button it still requires the user to fill in mandatory fields. I want the user to be able to just cancel the new record and go to another page. I've tried using "return false;" in the UI Action, but that code isn't allowed for some reason. Does someone know a way to abort a form submission by not using an onSubmit client script, but rather a UI Action?
current.setAbortAction(true);
var url = 'https://phcitest.service-now.com/u_finance_employee_expense_line.do?sys_id=-1&sysparm_query=u_employee_expense_request=' + current.u_employee_expense_request.sys_id.toString();
gs.setRedirect(url);
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 10:25 AM
I think you'll want to change this to run as a client-side UI action instead. Simply replace your URL in the function shown below. Also note that you don't need your instance prefix...just everything after the slash. Also make sure if you're on a London or later instance that the 'Isolate script' checkbox (which you may need to add to the form) is unchecked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 10:17 AM
Below link might helps you :
Mark answer as Correct if it solves your issue.
Thanks,
Ravi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 10:25 AM
I think you'll want to change this to run as a client-side UI action instead. Simply replace your URL in the function shown below. Also note that you don't need your instance prefix...just everything after the slash. Also make sure if you're on a London or later instance that the 'Isolate script' checkbox (which you may need to add to the form) is unchecked.