Name

sn_entitlement.UserHasSubscriptionDao

Description

No description available

Script

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

  /**
   * Counts the number of user_has_subscription records that match the subscription and the user is active
   *
   * @param {guid} subscriptionId The subscription_entitlement.sys_id to filter records by
   * @returns {number} A number 0 or greater indicating the number of rows that match
   */
  getCountBySubscriptionIdAndUserIsActive: function(subscriptionId) {
      const gr = new GlideRecord('user_has_subscription');
      gr.addQuery('subscription', subscriptionId);
      gr.addQuery('user.active', true);
      gr.query();
      return gr.getRowCount();
  },

  type: 'UserHasSubscriptionDao'
};

Sys ID

8478746fffd9a110468365d7d3b8fecf

Offical Documentation

Official Docs: