Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

JavaScript Executor

brown9394
Tera Expert

Hello experts,

How can I change State using state value from the JavaScript Executor? Instead of running through all the steps to get back to towards the end, I need to test multiple ui actions - I'm trying to use ctrl+shift+alt+j in the form to go back to a previous state. Is this possible?

Something like current.state == 5; - Nothing happens when I execute.

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

If you want to save the form you need to do this



g_form.setValue('state',5);


g_form.save();


View solution in original post

5 REPLIES 5

Abhinay Erra
Giga Sage

Only client side api's work there. use g_form.setValue('state',5);


Hi Abhinay,



That changed the state but it didn't bring back the functionality such as ui actions, etc. Upon reloading the form, the state changed back from 5 to 6.


Abhinay Erra
Giga Sage

If you want to save the form you need to do this



g_form.setValue('state',5);


g_form.save();


Thank you