…thoughts on ServiceNow and digital transformation

Post

ServiceNow function to check if fields are populated


    function checkIfFieldHasValue(fields, glideRecord) {
		// can be called from a UI action to make sure the fields have values before running a subflow or other process
		//fields: an array of field names
		//glideRecord: a gliderecord
        for (var i in fields) {

            if (!glideRecord[fields[i]]) {
                gs.addErrorMessage('The field ' + glideRecord[fields[i]].getLabel() + ' is missing a value');
                return false;
            }
        }
        return true;

    }