how to validate user group member in the script include

slimgam
Tera Contributor

Hi All,

 

we have a on call support, in the below script we are getting first on call of assignment group person, if user is not available we are using the CI record SME , so  i want to check that SME is also is part of the assignment group or not, if not want to field return empty.

 

please help me with code , how to achieve this

 

 

getAssignee: function(cmdbCiId, groupId) {
        //this function gets the First On Call for the Assignment group and passes it to the client script
        var ciID = cmdbCiId || this.getParameter('sysparm_ci');
        var group = groupId || this.getParameter('sysparm_group') + '';

        // Look for the group's first on-call
        gs.include("OnCallRotation");
        var rota = new OnCallRotation();
        rota.who(group);

        // return primary rota user if available
        if (rota.getPrimaryUser() && rota.getPrimaryUser() != null) {
            return rota.getPrimaryUser();
        }

        // return primary sme if available
        var ciGR = new GlideRecord('cmdb_ci');
        // If we can read the CI record, then get the SME
        if (ciGR.get(ciID) && ciGR.u_primary_sme) {
            return ciGR.u_primary_sme;
        }

        return 'none defined';
    },
1 REPLY 1

Slava Savitsky
Giga Sage

Where exactly are you having trouble? What part of your script is not working?