submit and redirect to list view in custom app
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
I have a custom app I am making in ui builder and I am wondering if someone can help me with a updating a the script on a ui action so that after I submit a form, it goes back to the list view of the form just like in native ui.
I tried the following script but it is still not redirecting back to list view after submitting successfully:
answer = current.insert();
if(answer){
action.setRedirectURL(current.getTa
bleName() + '.list')
}
gs.include('ActionUtils');
var au = new ActionUtils();
au.postInsert(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello @BrianaC,
I’m still a bit newer to UI Builder myself, and finished the UI builder course a few weeks ago. I haven't tried this out yet, but this is what I am thinking might work.
Instead of redirecting from the UI Action, I’d try handling this through events:
Open the component that’s doing the submit (button or form)
Go to the Events tab
Add an Event Handler
From there, use a navigation action like Link to destination and point it back to your list page
I pulled some screenshots from the UI Builder Fundamentals course:

Reference doc:
Manage actions in UI Builder pages
edit: I also see that it works with now assist, so this might be something cool to try out.
Configure an event handler with Now Assist
I hope this helps!
Sr. ServiceNow Developer | Infosys
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Jennifer Metz ,
Thank you for your suggestion. I was wondering if you happen to know what I can put in the condition for when to trigger of the redirect event because my concern is that it will redirect, even when the form does not submit properly, which is why I wanted to modify the UI action. I previously tried something similar but it would redirect to the list view every time I clicked the button, but when I was missing required fields it would not actually submit but still redirect anyways
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hey @BrianaC,
I see what you are saying. I did a little more research and it is not recommended to create any events that depend on each other since they do not evaluate in any specific order.
What I’d try instead is using a data resource for controlling the form. I took a look at the record page template and this seems like it is setup in a similar way. Once you have a data resource setup, then you have 2 possibilities where you can setup the redirect.
- From the data resource as it allows it's own events.
- Or from the event on the component, and set the trigger to conditional. In the conditional part, you can link it to your data resource and have something that checks if the form is valid so it only triggers if true.
Add and configure data resources to a page
Connect data to your components
Bind an event to a data resource
Please let me know if you run into any issues. I’m not a UIB wizard yet either, but I’ll definitely try my best to help.
Sr. ServiceNow Developer | Infosys
