Name

global.ConsumerProfileUtilSNC

Description

No description available

Script

var ConsumerProfileUtilSNC = Class.create();
ConsumerProfileUtilSNC.prototype = {
  initialize: function() {},
  
  getConsumerProfileRefQualifier: function(current) {
  	if (gs.nil(current) || gs.nil(current.consumer))
  		return;
  	return "consumer=" + current.consumer;
  },

  isValidProfileOfConsumer: function(consumer, consumerProfile) {
  	if (gs.nil(consumer) || gs.nil(consumerProfile))
  		return true;
  	var consumerProfileGR = new GlideRecord(global.CSMBaseConstants.CONSUMER_PROFILE_TABLE);
  	var isValidConsumerProfile = consumerProfileGR.get(consumerProfile);
  	if (isValidConsumerProfile && consumerProfileGR.consumer == consumer)
  		return true;
  },

  getConsumerProfileLocationReferenceQualifier: function(current) {
  	if(gs.nil(current) || gs.nil(current.getValue("consumer_profile")) || gs.nil(current.getElement("consumer_profile.consumer"))) {
  		return "consumerISNOTEMPTY";
  	}

  	return "consumer=" + current.getElement("consumer_profile.consumer");
  },

  isValidConsumerLocation: function(consumerId, locationId) {
  	if(gs.nil(consumerId) || gs.nil(locationId)) {
  		return false;
  	}

  	var locationGR = new GlideRecord(global.CSMBaseConstants.LOCATION_TABLE);
  	locationGR.addQuery("sys_id", locationId);
  	locationGR.addQuery("consumer", consumerId);
  	locationGR.setLimit(1);
  	locationGR.query();

  	return locationGR.next() && locationGR.canRead();
  },

  type: 'ConsumerProfileUtilSNC'
};

Sys ID

97bb9c0a0f8a1110e6d4fd820b767ed6

Offical Documentation

Official Docs: