Skip to main content

Notifications

Send an Email Notification When Customers Reply to a Case


This Power Automate flow sends an email notification to a specific address whenever a new email arrives in a shared mailbox. 🔥



As a trigger, use "When a new email arrives in a shared mailbox (V2).":
With the "Subject Filter" field, you can exclude emails that are created for new cases. In our case, we have the tracking tag "CRM" in the subject.


It would be even smarter to use a different tracking tag that couldn't accidentally be used in the customer's subject line. You can set the tracking tag under Advanced Settings -> Administration -> System Settings -> Email.



The next step is "Condition":
Value: triggerOutputs()?['body/from']
is not equal to
Value: your email to notify

In the "Yes" column of the condition, the first thing we add is a delay. We have occasionally experienced that the incoming email wasn't yet saved as an activity. Sometimes the flow started too early.



Next step: "List rows":
We want to use the Email table, but unfortunately, it doesn't work as usual for tables of type "Activity."
Therefore, you have to use the Activities table, filtering the current email by its subject.
Filter rows: subject eq '@{triggerOutputs()?['body/subject']}'
Sort by: createdon desc
Row Count: 1



Next, we create an "Apply to each" step:
Output: @{outputs('List_rows')?['body/value']}
New Step: "Get a row by ID": Here, we retrieve the current case using the RegardingObjectId, which is included in the email activity and points to the associated case.
Table Name: Cases
Row ID: @{items('Apply_to_each')?['_regardingobjectid_value']}


The final step:
"Send an email from a shared mailbox (V2)"

As an idea of how the notification email might look, here’s our email body:
<b><p>Someone replied to your Customer Service Case:</b><br>
<b>Title:</b> @{outputs('Get_a_row_by_ID')?['body/title']}<br>
<b>Case Number:</b> @{outputs('Get_a_row_by_ID')?['body/ticketnumber']}<br>
<b>Email:</b> @{triggerOutputs()?['body/from']}<br>
<b>Link:</b> <hyperlink>https://[dynamicsinstance]/main.aspx?appid=[appid]&pagetype=entityrecord&etn=incident&id=@{outputs('Get_a_row_by_ID')?['body/incidentid']}</hyperlink>

I hope the instructions were able to help some of you.

Comments