Name

sn_cmdb_int_util.CmdbIntegrationSoftwareBundleIdLookup

Description

Utility class to get the cleansed software information from a bundle id.

Script

var CmdbIntegrationSoftwareBundleIdLookup = Class.create();
CmdbIntegrationSoftwareBundleIdLookup.prototype = {
  initialize: function() {},

  lookupSoftware: function(bundleId) {
      var output = {};
  	if (gs.nil(bundleId)) {
  		output.result = "";
  		return output;
  	}
      var gr = new GlideRecord("sn_cmdb_int_util_bundleid_lookup");
      gr.addQuery("bundle_id", bundleId);
      gr.query();
      if (gr.next()) {
          if (gr.getValue("active") == false || gr.getValue("matched") == false) {
              output.result = "";
          } else {
              output.result = gr.getValue("artist_name") + '|||' + gr.getValue("track_name") + '|||' + gr.getValue("seller_name");
          }
      } else {
          gr.initialize();
          gr.bundle_id = bundleId;
          gr.matched = false;
          gr.insert();
          output.inserts = gr;
          output.result = "";
      }
      return output;
  },

  type: 'CmdbIntegrationSoftwareBundleIdLookup'
};

Sys ID

556fc736771030100dfa1bfaae5a996d

Offical Documentation

Official Docs: