Name

sn_hr_er.er_pipUtilsSNC

Description

No description available

Script

var er_pipUtilsSNC = Class.create();
er_pipUtilsSNC.prototype = {
  initialize: function(task, email) {
      this._gr = task;
      this._email = email;
      this._util = new sn_hr_core.hr_Utils();
  },

  /* Returns the ESC portal's case link
   *
   * @params:
   *
   * @returns
   *  string: contains the link to navigate to ESC portal
   */
  getLink: function() {
      if (this._shouldGoToServicePortal())
          return this._getPortalLink();
      else
          return this._getDefaultLink();
  },

  _shouldGoToServicePortal: function() {
      return this._checkCaseRecipientFields();
  },

  _checkCaseRecipientFields: function() {
      return this._email.recipient_fields.indexOf('subject_person.manager') >= 0;
  },

  _getPortalLink: function() {
      var portalSuffix = new sn_hr_sp.hr_TicketPageConfigUtil().getActivePortalURLSuffix();
      return gs.getProperty("glide.servlet.uri") + portalSuffix + '?sys_id=' + this._gr.sys_id + '&view=sp&id=' + new sn_hr_sp.hr_PortalUtil().ticketPage() + '&table=' + sn_hr_core.hr.TABLE_CASE + '&sysparm_url=true';
  },

  _getDefaultLink: function() {
      return gs.getProperty("glide.servlet.uri") + 'nav_to.do?uri=' + this._gr.sys_class_name + '.do?sys_id=' + this._gr.sys_id + '&sysparm_stack=' + this._gr.sys_class_name + '_list.do&sysparm_query=active=true';
  },

  type: 'er_pipUtilsSNC'
};

Sys ID

71efeca3ebd60110afa96bf3a2522888

Offical Documentation

Official Docs: