logger - Global

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:5分
  • The logger API provides inbound email actions that append messages to the email log.

    It provides methods that add information, warning, and error messages. The added message has its source set to email.<Sys ID of incoming email>.

    logger - log(String msg)

    Appends the specified message to the email log.

    表 : 1. Parameters
    Name Type Description
    msg String Text to append to the email log. These should be information type messages.
    表 : 2. Returns
    Type Description
    void

    This code example queries email from the sys_user table and then calls the appropriate logger method based on the sender information.

    var grUser = new GlideRecord("sys_user");
    grUser.addQuery("email", email.from);
    grUser.query();
      if (grUser.next()) {
        if (grUser.user_name) {
          logger.log("Sender found: " + email.from); //Append information message to the email log
          createInc(grUser.sys_id);
        } else {
            logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
            createInc(grUser.sys_id);
        }
      } else {
          logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
          current.setAbortAction(true);
      }

    logger - logError(String msg)

    Appends the specified error message to the email log file.

    表 : 3. Parameters
    Name Type Description
    msg String Error message to append to the email log
    表 : 4. Returns
    Type Description
    void

    This code example queries email from the sys_user table and then calls the appropriate logger method based on the sender information.

    var grUser = new GlideRecord("sys_user");
    grUser.addQuery("email", email.from);
    grUser.query();
      if (grUser.next()) {
        if (grUser.user_name) {
          logger.log("Sender found: " + email.from); //Append information message to the email log
          createInc(grUser.sys_id);
        } else {
            logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
            createInc(grUser.sys_id);
        }
      } else {
          logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
          current.setAbortAction(true);
      }

    logger - logWarning(String msg)

    Appends the specified warning message to the email log file.

    表 : 5. Parameters
    Name Type Description
    msg String Warning message to append to the email log
    表 : 6. Returns
    Type Description
    void

    This code example queries email from the sys_user table and then calls the appropriate logger method based on the sender information.

    var grUser = new GlideRecord("sys_user");
    grUser.addQuery("email", email.from);
    grUser.query();
      if (grUser.next()) {
        if (grUser.user_name) {
          logger.log("Sender found: " + email.from); //Append information message to the email log
          createInc(grUser.sys_id);
        } else {
            logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
            createInc(grUser.sys_id);
        }
      } else {
          logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
          current.setAbortAction(true);
      }