How to avoid reload site popup.

Neha_01
Tera Contributor

we are using scoped applications and a workspace, when we click on UI action, sometimes it gives reload site popup, what could be the possible reason or how to avoid that popup when clicking on UI action, there is no certain reproduceable steps, it is an unusual behavior.

 

 

Neha_01_0-1765540986056.png

 

7 REPLIES 7

Hi Ankur,

here is the UI action Server script, facing issue in workspace-


function checkoncompletion() {

    var reason = g_form.getValue('request_completion_reason');

   
    if (!reason) {
        g_form.setSectionDisplay('request_completion', true);
        g_form.setMandatory('request_completion_reason', true);
        g_form.showFieldMsg('request_completion_reason', 'Select an option', 'error', true);
        g_form.addErrorMessage('Mandatory Field need to be Filled in "Request Completion" Section');
        return false;  
    }

   
    gsftSubmit(null, g_form.getFormElement(), 'oncompletion');

   
    return false;
}
if (typeof g_form !== 'undefined') {
    // Do nothing on client side
} else {

   
    var reason = current.request_completion_reason.toString();

    if (reason == 'Cancelled / Rejected') {

 
        current.current_stage = '4';
        current.workflow_stage = 'Closure';
        current.state = 11;

        current.update();
        action.setRedirectURL(current);

    } else if (reason == 'Partial Amount Approved' || reason == 'Other' || reason == 'Approved') {

        current.state = 5;
        current.last_resolution_date = new GlideDateTime();
        current.update();
        action.setRedirectURL(current);
    }
}
 
 
 
Workspace client script-

function onClick(g_form) {


    var reason = g_form.getValue('request_completion_reason');


    // Validate only when empty
    if (!reason) {
g_form.setSectionDisplay('request_completion', true);
        g_form.setMandatory('request_completion_reason', true);
        g_form.showFieldMsg('request_completion_reason', 'Select an option', 'error', true);
        g_form.addErrorMessage('Mandatory Field need to be Filled in "Request Completion" Section');
        return false;   // stop submit and DO NOT run server script
    }


g_form.submit('oncompletion');
}

@Neha_01 

is that message coming in native or workspace?

what debugging did you do from your side?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sarthak Kashyap
Mega Sage

Hi @Neha_01 ,

 

This is coming from your browser when there are some changes that are not saved,

Did you give Action Name to your UI Action? If not please try to give and check

SarthakKashyap_0-1765556766057.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak