Name

sn_itom_pde.GetInstructionsForErrorCodeAJAX

Description

No description available

Script

var GetInstructionsForErrorCodeAJAX = Class.create();
GetInstructionsForErrorCodeAJAX.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

  retrieve: function() {
      var errorCode = this.getParameter('sysparm_errorCode');
      if (gs.hasRole('discovery_admin')) {
          var ecode = new GlideRecord('automation_error_code');
          var instruction = gs.getMessage('No Error Suggestions with instructions found');
          var sysId = '';
          ecode.addQuery('code', errorCode);
          ecode.query();
          if (ecode.next()) {
              sysId = ecode.sys_id;
              var emap = new GlideRecord('suggestion_error_code_m2m');
              emap.addQuery('error_code', sysId);
              emap.query();
              while (emap.next()) {
                  var suggestionSysId = emap.suggestion;
                  var esug = new GlideRecord('automation_error_suggestion');
                  esug.get(suggestionSysId);
                  if (esug.name.includes('instructions')) {
                      instruction = esug.message;
                      break;
                  }
              }
          }
          return instruction;
      }
  },

  type: 'GetInstructionsForErrorCodeAJAX'
});

Sys ID

b637fdbf771301104cb984e35b5a99b1

Offical Documentation

Official Docs: