We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Why is the code not being loaded and reflected?

t-takumi
Tera Contributor
When creating a button to change items within the form using a UI Action, the following code was loaded on the Now Platform. However, it does not load on the Service Operation Workspace. How can it be loaded?
function onClick(g_form) {
    current.u_state = 'review';  //set state to Published when button is clicked
    action.setRedirectURL(current);
    current.setWorkflow(false);
    current.update();
    current.setWorkflow(true);  
}
3 REPLIES 3

GlideFather
Tera Patron

Hi @t-takumi,

 

what do you mean isn't loaded?

 

If it's a onLoad client script, you can add "g_form.addInfoMessage('This script is executed);" to its start and then go to SOW and you'll see whether it's loaded or not... then you can continue but first let's find out if it is triggered or not.

 

Please let me know the result

_____
100 % GlideFather experience and 0 % generative AI

@t-takumi sorry after my second read I noticed that you mentioned UI Action,  not client script...

 

can you please share it with us? if it's UI Action, scroll down there are buttons "Format for Workspace" and "Workspace form" that might require checking them true:

GlideFather_0-1756132719274.png

 

Eventually create a new declarative action.

_____
100 % GlideFather experience and 0 % generative AI

Hi @t-takumi any progress?

_____
100 % GlideFather experience and 0 % generative AI