If you change screens after saving with "g_form.save()", the form is not saved.

bonsai
Mega Sage
g_form.save();
g_navigation.open('incident_list.do');

I implemented the above script in a client checked UI action and tried to move the screen after saving the record.

However, the record was not saved and the screen moved forward.

 

If you just use "g_form.save()" it will be saved.

 

 

I tried to implement asynchronous processing by referring to the following article.

https://www.servicenow.com/community/developer-forum/is-g-form-save-async/m-p/2936035

 

g_form.save().then(g_navigation.open('incident_list.do'));

 But the results were panned without being saved.

 

Is there a way to save a new record and then transition to another screen?
I need to make this a client specification because I want to display a popup.

1 ACCEPTED SOLUTION

@bonsai 

why not use client + server code using gsftSubmit()

in server side use this

current.update();

action.setRedirectURL('incident_list.do');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

where have you written this script?

What's the current behavior?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Created using UI actions.
The client checkbox is checked.

When clicked, "test( )" is executed.

 

function test( ){
g_form.save().then(g_navigation.open('incident_list.do'));
}

 

@bonsai 

why not use client + server code using gsftSubmit()

in server side use this

current.update();

action.setRedirectURL('incident_list.do');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader