{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":39788,"path":"platform-administration/t_CreatingAnInboundEmailAction.md","title":"Create an inbound email action","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create an inbound email action\n\nCreate inbound email actions to define the actions that the system takes when an email is received.\n\n## Before you begin\n\nRole required: admin\n\n## Procedure\n\n1.  Navigate to **All** &gt; **System Policy** &gt; **Email** &gt; **Inbound Actions**.\n\n2.  Select **New**.\n\n3.  Fill in the fields as described in the table.\n\n    **Note:** You might need to configure the form to see all fields.\n\n<table id=\"table_kyc_qhz_lp\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td class=\"sub-head\" colspan=\"2\">\n\nWhen to run\n\n</td></tr><tr><td>\n\nName\n\n</td><td>\n\nEnter a descriptive name for this email action.\n\n</td></tr><tr><td>\n\nTarget table\n\n</td><td>\n\nSelect the table where the action adds or updates records.\n\n</td></tr><tr><td>\n\nAction type\n\n</td><td>\n\nSelect the type of action the instance takes. Select **Record Action** to modify a record in the instance, or select **Reply Email** to have the instance send an email back to the source of the inbound email.\n\n</td></tr><tr><td>\n\nActive\n\n</td><td>\n\nSelect the check box to activate the inbound email action. Clear the check box to disable the action.\n\n</td></tr><tr><td>\n\nStop processing\n\n</td><td>\n\nSelect this check box to help prevent the system from running additional inbound email actions after this action runs.\n\n</td></tr><tr><td>\n\nRedact sensitive data\n\n</td><td>\n\nSelect this to mask sensitive data such as personal details, SSN, credit card details.**Note:** Available only when Sensitive Data Redaction for Inbound Emails plugin is activated.\n\n</td></tr><tr><td>\n\nType\n\n</td><td>\n\nSelect the message type required to run the action. The action runs only if the inbound email is of the selected type. Available types are:-   New: An email that is not recognized as a reply or forward.\n-   Reply: An email with a watermark with an In-Reply-To email header, or whose subject line begins with a recognized reply prefix.\n-   Forward: An email whose subject line begins with a recognized forward prefix, even if the email also contains a watermark or In-Reply-To header.\n **Note:** By default, inbound emails of the Forward type always generate new incidents regardless of the presence of a watermark. If this behavior doesn’t match your business logic, you can change the recognized reply and forward prefixes to treat forwards like replies.\n\n</td></tr><tr><td>\n\nRequired roles\n\n</td><td>\n\nSpecify required roles that the sender must have to trigger the inbound action.\n\n</td></tr><tr><td>\n\nOrder\n\n</td><td>\n\nEnter a number that specifies when this inbound action runs relative to other inbound actions that use the same target table. The instance processes the action with the lowest order number first.\n\n</td></tr><tr><td>\n\nFrom\n\n</td><td>\n\nSelect the user required to run the action. If a user is selected, the action runs only when the email sender matches the user name. Leave this field empty to perform the action for all users.**Note:** If the selected user is later archived or deleted, the restriction is removed and anyone can trigger the inbound email action.\n\n</td></tr><tr><td>\n\nCondition\n\n</td><td>\n\nSpecify the condition that must evaluate to true to trigger the inbound action. Build a condition with the choice lists or enter a statement that determines when the inbound email action runs. For example:```\nemail.subject. startsWith ( \"chg:\" )\n```\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nActions\n\n</td></tr><tr><td>\n\nField actions\n\n</td><td>\n\nThis field appears if the **Action type** is **Record Action**. Specify how information in the email is inserted into the record. For example, select **\\[Created by\\]** **\\[From email\\]** **\\[Sender\\]**, so that when the request is inserted, you can see who it is for.\n\n</td></tr><tr><td>\n\nReply email\n\n</td><td>\n\nThis field appears if the **Action type** is **Reply Email**. compose the email message to send to the source that triggered the inbound email action.\n\n</td></tr><tr><td>\n\nScript\n\n</td><td>\n\nEnter the script that the action runs. Typically, this script uses the validators script include and email variables. A template is provided:\n\n ```\n\n(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger) {\n\n\t// Implement email action here\n\n})(current, event, email, logger);\n```\n\n The following objects are available:\n\n-   **current**: access the record referred to by the inbound email. For example, `current.assigned_to` accesses the person assigned to the task.\n-   **event**: access one of the parameters of the originating event. For example, `event.parm1` accesses the first parameter of the event or `event.parm2` for the second parameter. See [Events](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/events.md) for more information.\n-   **email**: access the inbound current email record. For example, `email.subject` accesses the content in the subject line of the email. See [Accessing email object variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/r_AccessingEmailObjsWithVars.md) for more information.\n-   **logger**: add a message to the log file with the source set to `email.<Sys ID of incoming email>`. For example: `logger.log (\"Some information\")`\n\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nDescription\n\n</td></tr><tr><td>\n\nDescription\n\n</td><td>\n\nEnter a detailed explanation of what this inbound email action does.\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nOther fields\n\n</td></tr><tr><td>\n\nOrder\n\n</td><td>\n\nEnter a number to define the order in which this email action should be processed. Actions with lower numbers are processed first. The Ordered Email Processing plugin does not activate this field.\n\n</td></tr></tbody>\n</table>\n**Parent Topic:**[Use Inbound email actions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/use-inbound-email-action.md)\n\n"}}