We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to prevent reloading the page multiple times in workspace

Kiran29
Tera Contributor

Hi,

I am using the below server script and client script within UI action, is there a way I can prevent reloading the page multiple times. Actually want to reload only when first if statement is true. 

Thanks,

 

Server script:

 
var util = new KeywordRoutingUtil();
var result = util.evaluateRouting(current);
if (result.abort) {
gs.addErrorMessage(result.message);
gs.setRedirect(current);
} else {
//current.update();
gs.setRedirect(current);
current.insert();
}

Client Script:

function onClick(g_form) {
    g_form.submit('save_action');
    g_form.reload();
}
1 REPLY 1

Tanushree Maiti
Tera Patron

Hi @Kiran29 

 

Can you try  replacing  g_form.reload() by reloadWindow(window)   as per following post :

 

https://servicenowguru.com/client-scripts-scripting/reload-form-related-list-client-script/

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti