Name

global.DiscoLogToHTML

Description

No description available

Script

var DiscoLogToHTML = Class.create();
DiscoLogToHTML.prototype = {
   initialize: function(table, sys_id, saDiscoLogSysId, ip_address, pid, pre_execution, host_sys_id, host_name, pattern_id, pattern_name, pattern_type, is_cloud, link_name, link) {
      this.table = table;
      this.sys_id = sys_id;
      this.saDiscoLogSysId = saDiscoLogSysId;
      this.ip_address = ip_address;
      this.pid = pid;
  	this.pre_execution = pre_execution;
  	this.host_sys_id = host_sys_id;
  	this.host_name = host_name; 
      this.pattern_id = pattern_id;
  	this.pattern_name = pattern_name; 
  	this.pattern_type = pattern_type;
  	this.is_cloud = is_cloud;
      this.link_name = link_name;
  	this.values = {};
      this.link = link;
      this.values['sys_id'] = sys_id;
  },
  
  /*
   * Set a field value.  This is useful if the calling code has already read the underlying GlideRecord, and wants to avoid
   * the overhead of another database read.
   */
  setValue: function(name, value) {
      this.values[name] = value;
  },
  
  /*
   * Converts this instance to a string.
   */
  toString: function() {
      // some setup...
      var gr = new GlideRecord(this.table);
      var gr_read = false;
      var regex = /^(.*?)\$\{([^\}]+?)\}(.*)$/;
      
      // make all our escape substitutions...
      var rr = regex.exec(this.pattern);
      while (rr) {
          var fn = rr[2];
          var fv = this.values[fn];
          if (!fv) {
              if (!gr_read) {
                  gr.get(this.sys_id);
                  gr_read = true;
              }
              fv = gr.getValue(fn);
              this.values[fn] = fv;
          }
          this.link_name = rr[1] + fv + rr[3];
          rr = regex.exec(this.pattern);
      }
      
      // surround with an "a" tag, if this is to be a link...
       if (this.link)
          this.link_name = '<a href="' + this.table + '.do?discoLogId=' + this.sys_id + '&amp;saDiscoLogSysId=' + this.saDiscoLogSysId+ '&amp;ipAddress=' + this.ip_address + '&amp;pid=' + this.pid +  '&amp;preExecution=' + this.pre_execution + '&amp;host_sys_id=' + this.host_sys_id + '&amp;host_name=' + this.host_name + '&amp;patternId=' + this.pattern_id + '&amp;patternName=' + this.pattern_name + '&amp;patternType=' + this.pattern_type + '&amp;isCloud=' + this.is_cloud + '&amp;isHistoricalLog=true"><u>' + this.link_name + '</u></a>';
  	        
      return this.link_name;
  },
  
  toUrl: function() {
      return this.table + '.do?discoLogId=' + this.sys_id + '&saDiscoLogSysId=' + this.saDiscoLogSysId+ '&ipAddress=' + this.ip_address + '&pid=' + this.pid +  '&preExecution=' + this.pre_execution + '&host_sys_id=' + this.host_sys_id + '&host_name=' + this.host_name + '&patternId=' + this.pattern_id + '&patternName=' + this.pattern_name + '&patternType=' + this.pattern_type + '&isCloud=' + this.is_cloud + '&isHistoricalLog=true';
  },

  type: 'DiscoLogToHTML'
};

Sys ID

ad2d12f59f1022003cb191aec32e7099

Offical Documentation

Official Docs: