Name

sn_employee.ep_Licensing

Description

Provide APIs for getting if a user has access for an app

Script

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

  /** 
   *  Function to return if there is an active app access record for the user and app name provided
   *  @param {String} appName - app name of Licensed Application (sn_employee_app)
   *  @param {String} userId - user sys_id
   *  @returns Boolean if there is an active app access record, false otherwise
   */
  isUserLicensed: function(appName, userId) {
      var licenseGr = new GlideRecord('sn_employee_app_access');
      licenseGr.addQuery('profile.user', userId);
      licenseGr.addQuery('app.name', appName);
      licenseGr.addActiveQuery();
      licenseGr.query();
      return licenseGr.hasNext();
  },

  type: 'ep_Licensing'
};

Sys ID

062556a077911110a956b9999a5a99bf

Offical Documentation

Official Docs: