UI action

carlosromero
Giga Contributor

my UI action is not saving the changes i am working on change form.

find_real_file.png

find_real_file.png

when i click on my ui action this one change the state for closed but when i click again on my ui action it should continue to from implementation to close fase and save the changes

1 ACCEPTED SOLUTION

Mwatkins
ServiceNow Employee
ServiceNow Employee

Hi Carlos,


It looks to me like you might be running a client-side UI Action. Client-side UI Actions normally run twice. First, on the client side, based on the function specified in the Onclick field and, second, the script runs on the server after the form is submitted. The if statement that checks for typeof window == 'undefined' is a check to ensure that the method specified after the if statement is only run on the server. I see that the method specified after your if statement is "updateAndRedirect()". However, in your code there is no "updateAndRedirect()" method. Did you mean to call the "setRedirect()" method instead?



I think line 13 might need to be changed from:


if (typeof window == 'undefined') updateAndRedirect();


to:


if (typeof window == 'undefined') setRedirect();



Regards, Matthew


View solution in original post

1 REPLY 1

Mwatkins
ServiceNow Employee
ServiceNow Employee

Hi Carlos,


It looks to me like you might be running a client-side UI Action. Client-side UI Actions normally run twice. First, on the client side, based on the function specified in the Onclick field and, second, the script runs on the server after the form is submitted. The if statement that checks for typeof window == 'undefined' is a check to ensure that the method specified after the if statement is only run on the server. I see that the method specified after your if statement is "updateAndRedirect()". However, in your code there is no "updateAndRedirect()" method. Did you mean to call the "setRedirect()" method instead?



I think line 13 might need to be changed from:


if (typeof window == 'undefined') updateAndRedirect();


to:


if (typeof window == 'undefined') setRedirect();



Regards, Matthew