submit and redirect to list view in custom app

BrianaC
ServiceNow Employee
ServiceNow Employee

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.getTaClick to expand Click to expand Community Resources category Click to collapse Community Resources categorybleName() + '.list')
}
gs.include('ActionUtils');
var au = new ActionUtils();
au.postInsert(current);

 
1 REPLY 1

Jennifer Metz
Giga Guru

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:

  1. Open the component that’s doing the submit (button or form)

  2. Go to the Events tab

  3. Add an Event Handler

  4. 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:

 

Lab6 D3.png

Lab6 D4.png

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!

 

Jennifer Metz
Sr. ServiceNow Developer | Infosys