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.

using GlideAjax to update Change Request

DoDo labs___
Mega Sage

Hello, can you help me why this simple script include doesn't work?

 

Name: FIG_update_comments

Application: Global

Accesible from: All application scopes

 

Script:

 

var FIG_update_comments = Class.create();
FIG_update_comments.prototype = Object.extendsObject(AbstractAjaxProcessor, {
 
upd: function()
    {
        var chg = new GlideRecord('change_request');
        chg.addQuery('number', 'CHG0033796');
        chg.query();
        if (chg.next())
            {
                chg.comments = 'Updated!';
                chg.update();
                gs.addInfoMessage('Updated!');
            }
 
    },
 
    type: 'FIG_update_comments'
});
 
onLoad Client Script script:
 

var ga = new GlideAjax('FIG_update_comments');
ga.addParam('sysparm_name', 'upd');
ga.getXML(mycallback);

function mycallback(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
}

 

 

7 REPLIES 7

Hello, unfortunately there is no alert, i think, the script didn't run.

@DoDo labs___  No problem.

Are you trying it on your personal instance ? if yes i can quickly check it , please confirm.

 

Also if possible can you share screenshot of your script include and client script ,make sure you checked client callable true on your script include .

 

Thanks,

Harsh

No, it's not personal instance.

 

Here are the screenshots:

 

DoDolabs____0-1701276210733.png

 

DoDolabs____1-1701276410141.png