Create an email client template

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:22分
  • Create a different template for each table that uses the email client to pre-populate data for recipients and email content.

    始める前に

    Role required: admin

    このタスクについて

    The email client uses its own email templates to define default values for fields. Use the following sections in the Email Client Template form to build a client template:
    • Content: The message body.
    • Recipients: The email addresses of users receiving the email message. The email addresses are displayed in the To, Cc, and Bcc fields of the message.
    • Sender Configuration: The method used to generate the email sender (From email address) of the message.

    手順

    1. Navigate to All > Email Client > Email Client Templates.
    2. Select New.
    3. On the form, fill in the fields.
      表 : 1. Email Client Template form
      Field Description
      Name Unique template name.
      Table The table that the template applies to. Enable the email client for the same table.
      Conditions The conditions that determine when this client template is used. Use the condition builder to identify the target record that must match before this template is applied to the email client.
      注:
      Conditions are only used for to apply a default template upon initial load. Conditions are not used when loading a custom email template from a workspace sidebar.
      Application The type of scoped application.
      Execution Order A number that indicates the order in which the template conditions are evaluated. The template with the lowest execution order is considered.
      Include attachment from email Option for including attachments from email to the replyall-received, reply-received, forward-sent, reply-sent, replyall-sent, and forward-received response templates.
      注:
      This option is applicable only for response email in a configurable workspace.
    4. On the Content tab, fill in the fields.
      表 : 2. Content tab
      Field Action
      Subject Enter a description of the email.
      注:
      The Subject field on the email client allows a larger character count than the default setting for the Subject field in the Email [sys_email] table. If the subject text from the client is being truncated, increase the Max length value for the Subject field in the Email table.
      Content Type Select the format of the message body content: HTML or plain text.
      Body HTML

      If you've selected HTML for the Content Type field, enter the content of the message body using the HTML editor toolbar to format the HTML.

      To reference field values, select variables from the variables list or manually type variable references using the syntax ${table_name.variable_name}. To reference the user who launches the email client, enter the variable ${current_user}.
      注:
      Line breaks don't appear for multi-line fields such as ${description} and ${comments} in the email client template.

      You can call a mail script by using ${mail_script:script name} in the Body HTML field.

      Body text

      If you selected plain text for the Content Type field, enter any text or mail script that you want to appear in the message body.

      You can insert a mail script in the Body text field by using the following syntax:
      <mail_script> [code] </mail_script>
    5. On the Recipients tab, fill in the fields.
      表 : 3. Recipients tab
      Field Action
      To Enter a comma-separated list of either field names that contain user email addresses or just email addresses. To reference an email address using a script, create a script include and then call the script include in the To field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string. Use only one JavaScript expression and do not combine it with field names.
      Cc

      Enter a comma-separated list of either field names that contain user email addresses or just email addresses. To reference an email address using a script, create a script include and then call the script include in the Cc field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string. Use only one JavaScript expression and do not combine it with field names.

      This field can’t have the same addresses as the To field.

      Bcc

      Enter a comma-separated list of either field names that contain user email addresses or specific email addresses. To reference an email address using a script, create a script include and then call the script include in the Bcc field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string. Use only one JavaScript expression and do not combine it with field names.

      This field can’t have the same addresses as the To or Cc fields.

    6. On the Sender Configuration tab, select the From Generation Type method to determine how the sender (From address) in the email client message is generated.
      TypeDescription
      None The From address isn’t generated in the email client message.
      SMTP Email Account Use the From address of the SMTP email account for the instance as the sender.
      Select From List Choose from a list of allowable From addresses defined in the Email Client From Address [sys_email_client_from_address] table.
      Script Run a GlideRecord query on the Email Client From Address [sys_email_client_from_address] table.
      For example, the following script sets the From address based on the location of the incident caller:
      (function (fromAddressQuery, targetRecord) {
          // targetRecord is incident for this template
          var location = targetRecord.caller_id.country;
      
          if (location == 'us')
              fromAddressQuery.addQuery('email_address', 'servicedesk.us@example.com');
          else if (location == 'japan')
              fromAddressQuery.addQuery('email_address', 'servicedesk.jp@example.com');
          else if (location == 'uk')
              fromAddressQuery.addQuery('email_address', 'servicedesk.uk@example.com');
      
      })(fromAddressQuery, targetRecord);
      Text Enter the email From address to be used in the client.
      User Email Addresses For integrating users or agents personal corporate mail boxes with ServiceNow to send and receive emails.
      注:
      This requires User Mailbox Integration (com.glide.email.user_mailbox.integration) plugin to be installed.
      Use this method only if you want a different From address than the one defined in your SMTP email account.
      注:

      The From email address doesn’t appear in the email client unless you configure an email client to display the From address. For more information on managing the behavior of an email client, see Email client configurations.

      If the domain for the From address isn’t the domain of the SMTP email account server, the owner of the From domain address must configure the SPF record for the domain. The owner changes the domain settings to enable the instance to send an email as if from that domain. For more information on using SPF records, see ServiceNow KB0535456.

    7. Select Submit.
      The template is added to the Email Client Templates [sys_email_client_template] table.

    Apply an email client template

    After you create an email client template, you can apply it to an email.

    始める前に

    Role required: admin

    このタスクについて

    The following steps are implemented only after creating an email client template

    手順

    1. Click the ellipsis (...) icon at the top of the template to apply the template to an email.
    2. Select Email.
    3. Fill in the fields to compose an email.
      See Create an email client template for field details.
      注:
      The body of the email is filled up with the details from the incident record. If you modify one or more fields in the incident record and are not saved, the unsaved changes still reflect in the email body.
      注:
      2000 characters is the total limit for all the changes in the incident record. If some of your changes are not reflected and get truncated in the email body, this is because the total changes is more than 2000 character limit.

    Create an email client response template

    You can now create custom email client response templates that support conditions.

    始める前に

    Role required: admin

    このタスクについて

    Email client template is applied automatically in the email client based on the specified table, conditions, and execution order.

    手順

    1. Navigate to All > Email Client > Email Client Templates.
      The following options for Response Template - Received and Response Template - Sent show up.
    2. Click one of the available options to create a template for that selected option.
    3. Fill in the fields at the top of the Email Client Template form.
      Field Description
      Name Auto-filled template name based on the selected template option.
      注:
      This is a read-only field.
      Table Auto-filled table name.
      注:
      This is a read-only field because for response templates, the table name is always sys_email.
      Conditions The conditions that determine when this client response template is used. Use the condition builder to identify the target record that must match before this template is applied.
      注:
      If the conditions are not true, the email client gets the default template.

      Select the target table name under conditions that the template applies to. Enable the response template for the same table.

      Image showing the target table
      Application The type of scoped application.
      Execution Order A number that indicates the order in which template conditions are evaluated.
    4. Fill in the fields in the Content tab.
      Field Description
      Subject Enter a description of the email.
      注:
      The Subject field on the email client allows a larger character count than the default setting for the Subject field on the Email [sys_email] table. If the subject text from the client is being truncated, increase the Max length value for the Subject field on the Email table.
      Content Type Select the format of the message body content: HTML or plain text.
      Body HTML

      If you selected HTML for the Content type, enter the content of the message body using the HTML editor toolbar to format the HTML.

      To reference field values, select variables from the variables list or manually type variable references using the syntax ${table_name.variable_name}. To reference the user who launches the email client, enter the variable ${current_user}.
      注:
      Line breaks don't appear for multi-line fields such as ${description} and ${comments} in the email client template.

      You can call a mail script by using ${mail_script:script name} in the Body HTML field.

      Body text

      If you selected plain text for the Content type, enter any text or mail script that you want to appear in the message body.

      You can insert a mail script in the Body text field by using the following syntax:
      <mail_script> [code] </mail_script>
    5. Fill in the fields in the Recipients tab.
      Field Description
      To Enter a comma-separated list of either field names that contain user email addresses or just email addresses. To reference an email address using a script, create a script include and then call the script include in the To field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string. Use only one JavaScript expression and do not combine it with field names.
      Cc

      Enter a comma-separated list of either field names that contain user email addresses or just email addresses. To reference an email address using a script, create a script include and then call the script include in the Cc field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string. Use only one JavaScript expression and do not combine it with field names.

      This field can’t have the same addresses as the To field.

      Bcc

      Enter a comma-separated list of either field names that contain user email addresses or specific email addresses. To reference an email address using a script, create a script include and then call the script include in the Bcc field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string. Use only one JavaScript expression and do not combine it with field names.

      This field cannot have the same addresses as the To or Cc fields.

    6. In the Sender Configuration tab, select the From Generation Type to determine how the sender (From address) in the email client message is generated.
      Use this field only if you want a different From address than the one defined in your SMTP email account.
      • None: The From address is not generated in the email client message.
      • SMTP Email Account: Use the From address of the SMTP email account for the instance as the sender.
      • Select From List: Choose from a list of allowable From addresses defined in the Email Client From Address [sys_email_client_from_address] table.
      • Script: Run a GlideRecord query on the Email Client From Address [sys_email_client_from_address] table.
        For example, the following script sets the From address based on the location of the incident caller:
        (function (fromAddressQuery, targetRecord) {
            // targetRecord is incident for this template
            var location = targetRecord.caller_id.country;
        
            if (location == 'us')
                fromAddressQuery.addQuery('email_address', 'servicedesk.us@example.com');
            else if (location == 'japan')
                fromAddressQuery.addQuery('email_address', 'servicedesk.jp@example.com');
            else if (location == 'uk')
                fromAddressQuery.addQuery('email_address', 'servicedesk.uk@example.com');
        
        })(fromAddressQuery, targetRecord);
      • Text: Enter the email From address to be used in the client.
      注:
      The From email address does not appear in the email client unless you configure email client to display the From address. For more information on managing the behavior of email client, see Email client configurations.

      If the domain for the From address is not the domain of the SMTP email account server, the owner of the From domain must configure the SPF record for the domain. The owner changes the domain settings to allow the instance to send email as if from that domain. For details on using SPF records, see ServiceNow KB0535456.

    7. Click Submit.