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 Sage

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 mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: