Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to make a Glide Ajax call in Workspace Client Script ?

KelvinY2025
Mega Contributor

function onClick(g_form) {
    g_modal.confirm("Confirm", "Are you sure ?", function(response) {
        doSubmit();
    }, {
        cancelTitle: "Cancel",
        confirmTitle: 'Confirm'
    });

    function doSubmit() {
        console.log("doSubmit");  <= can console log 
 
        var ga = new GlideAjax('uiBuilderAction');
        ga.addParam('sysparm_name', 'cancelIncidentIncident');
        ga.addParam('sysparm_id', g_form.getUniqueValue());
        ga.getXMLAnswer(function(response) {
            if (response) {
                var result = response;
                if (result != 'success') {
                    g_form.addErrorMessage('Error: ' + result);
                } else {
                    g_form.save();
                }
            } else {
                g_form.addErrorMessage('No response from server or invalid response.');
            }
        });
    }
}

Error meg:  
POST https://dev306480.service-now.com/xmlhttp.do 404 (Not Found)
Unhandled exception in GlideAjax. undefined
0 REPLIES 0