By default, the system ignores the domain that the inbound email action record is in when it creates a record based on the inbound email action. Generally, you should create your inbound email actions in a global domain. However, if you have one or more domain-separate instances, you might need to create an Inbound action that is applicable only for a particular domain.


  • Make sure that the Overrides field of each inbound email action is empty.
  • For one particular table, make sure the order of each inbound action is unique.
  • For more details about how to create Inbound Actions, see the documentation topic Creating an Inbound email action.html

In the action tab of the inbound email action, make sure to add conditions to make the inbound email action domain-specific.

For example:

if(gs.getUser().getDomainID() != <sys_id_of_the_domain>

 These conditions ensure that the code enclosed within the condition will run ONLY IF the user who is sending the email is from the specified domain.

Having else if blocks also enable you to add multiple checks for multiple domains.


This section provides a very simple example of how to create a domain-specific inbound email action.

  1. Make sure Domain Separation is active in your instance and the global domain is selected on the domain picker.

  2. Navigate to System Policy > Email > Inbound Actions and click New.

  3. Provide the following values:

    • Name: Create Incident – Oceanic
    • Target Table: Incident [incident]
    • Active: Check
    • Script:
    (function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
       if(gs.getUser().getDomainID() != 'c9434fce4a3623120181f955f4a3d6e9'){
          current.caller_id = gs.getUserID();
          current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
          current.short_description = "For Oceanic Domain : " + email.subject;
          current.category = "inquiry";
          current.incident_state = IncidentState.NEW;
          current.notify = 2;
          current.contact_type = "email";
          if (email.body.assign != undefined)
             current.assigned_to = email.body.assign;
          if (email.importance != undefined) {
             if (email.importance.toLowerCase() == "high")
                current.priority = 1;
          if (email.body.priority != undefined)
             current.priority = email.body.priority;
       })(current, event, email, logger, classifier);
  4. Deactivate the Create Incident Inbound Action.

    1. Go to https://<instance>

    2. Uncheck Active.

    3. Save the record.

  5. Navigate to User Administration > Users, then select the demo user Abel Tuter.

  6. Change Email to an email ID that you can also use, and change its domain to Oceanic Airlines.

  7. Send an email message to your ServiceNow instance's email ID from the email ID value you set.

    These steps create an Incident on the Oceanic Airlines domain. To check whether this inbound action works only on the Oceanic Airlines domain, send an email message from any other email ID that is associated with a user who does not belong to the Oceanic Airlines domain.

Current Limitations

  • The Domain and Overrides fields do not work in the Inbound Actions table.
  • Once an inbound section is created in the global domain, administrators from all domains can access and change it.

Article Information

Last Updated:2019-12-17 00:16:11