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.

Class functions from script include are not getting called in Lab platform

saradaa
Kilo Contributor

I copied code from labs exactly and did multiple labs, but could never get a call to class function working in lab instance. If I change it to function code only , it works. Below is a snippet of code.

 

Now able to call class function in business rule and client script. I have made sure that I copy code exactly from the lab work.

 

Script:

-------

var AssignmentGroupUtils = Class.create();
AssignmentGroupUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    countGroupMembers: function() {

        var grpName = "";
        var message = "There are no members in this Assignment Group";
        var groupID = this.getParameter('sysparm_group_id');

        var grpMems = new GlideRecord('sys_user_grmember');
        grpMems.addQuery('group.sys_id', groupID);
        grpMems.query();

        if (grpMems.next()) {
            grpName = grpMems.getDisplayValue('group');
        } //close if

        if (grpName != "") {
            message = "There are " + grpMems.getRowCount() + " members in the " + grpName + " group";
        } //close if

        return message;

    },

    type: 'AssignmentGroupUtils'
});

0 REPLIES 0