retrieve all catalog variables

see https://docs.servicenow.com/bundle/orlando-application-development/page/script/server-scripting/concept/c_ScriptableServiceCatalogVariables.html

retrieve_variables: function(RITMsysid) {
/*call the function this way:
var si=new cu_request().retrieve_variables('f9405a06db859cd0be49fe03f39619ee');
gs.print(si);
*/
        var arrReturn = [];
        try {
            var grRITM = new GlideRecord('sc_req_item');
            if (grRITM.get('sys_id', RITMsysid)) {
                var RITMvariables = grRITM.variables.getElements();
                for (var ix = 0; ix < RITMvariables.length; ix++) {
                    var question = RITMvariables[ix].getQuestion();
                    //gs.log(question.getLabel() + ":" + question.getValue());
                    arrReturn[ix]=(question.getLabel() + ":" + question.getValue());
                }
            }
        } catch (ex) {

        }
        return arrReturn;
    },

Comments

Popular posts from this blog

GlideRecord setValue

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy