Change Incident State from Outbound Email

Richard22
Tera Expert

Hi ServiceNow Community,

I’m working on a business rule or a flow to automatically update the state of an Incident to "On Hold" when a technician sends an email using the ServiceNow email client in Incident Management. Despite my efforts, the rule isn’t functioning as expected, and I’m hoping someone can provide guidance or share their experience with similar implementations.


Details of My Use Case:

  1. How Emails Are Sent:

    • Emails are sent using the email client in ServiceNow Incident Management.
    • These emails are not draft emails—they are directly sent and move to the "sent" state in the sys_email table.

  2. What I’m Trying to Achieve:

    • When an email is sent from an Incident, I want to check if the sender (user_id in sys_email) matches the assigned_to field on the Incident.
    • If they match, the Incident’s state should be updated to "On Hold," and a work note should be added for tracking purposes.

  3. Challenges Encountered (business rule):

    • The business rule is set to run on the sys_email table, triggered After Insert.
    • I’ve tried using the target_table field in the sys_email record as a condition (current.target_table == 'incident'), but the rule doesn’t seem to trigger or execute properly.
    • The sender will always be different for each email, but the email template remains the same.

  4. Challenges Encountered (flow):
    • I can check if there is activity in an incident, but if even one email is sent, the rule executes, I cannot check the last activity. 
    • I cannot pull directly from the sys_email table which would be the easiest option, hwoever, is not selectable in trigger. 

  5. What I’ve Tried:

    • Baking the target table check into the script itself, rather than relying on the condition in the business rule.
    • Adding debug logs to identify where the script might be failing and within Flow Designer, but the triggers never even happen.
    • Testing emails with different configurations (e.g., checking draft emails, verifying user_id, etc.).
    • Ensuring the state value for "On Hold" (3) matches the configuration in my instance.
1 REPLY 1

Chavan AP
Tera Guru
Can you try it below?

Trigger: Record Updated
Table: Incident [incident]
Condition: Activity entries updated

Flow Logic:

Look Up Records on sys_email table:

Condition: target = Trigger - Incident Record AND state = sent AND sys_created_on > {{NOW - 2 MINUTES}}


For Each email found:

If email sender = incident assigned_to:

Update Record: Set incident state to "On Hold"
Update Record: Add work notes
Chavan AP
[ Architect | Certified Professional]

Was this response helpful? If so, please mark it as Helpful and Accept as Solution to help others find answers.