Select to view content in your preferred language

Power Automate to Send Emails when certain fields are updated

1861
13
02-08-2024 09:04 AM
EdDean
by
Emerging Contributor

Hello Everyone,

I am in the process of configuring the Citizen Problem Reporter for our community. I have created several Power Automate flows to email citizens when a request is submitted, updated, or when comments are created. I am running into an issue when I try to configure the flow to send emails when only certain fields in the request feature layer is updated. I have tried several different things with no luck. So I am looking to the community for help.

How would I configure the Power Automate flow to only send emails when certain fields are updated? The flow below works if any field is updated in the feature layer.

PowerAutomateUpdate.PNG

13 Replies
JustPete
Regular Contributor

From what I've tried to see, the issue is trying to get the previous version and updated version of the data. In this instance, you need to have "When a record is updated" as the trigger, then fetch updates and get data from feature later with a where clause. where=objectid=<triggerOutputs()?['body/attributes/objectid']> or something. Once you have the two versions, you need a condition to compare the two layers with the attribute in question to return the true value: triggerOutputs()?['body/attributes/field'] != <previous_value>

I'm going to try and work on it for a bit, since I have a feature layer with over 200 fields and don't need an email when there is a change with every one

0 Kudos
JustPete
Regular Contributor

Hi EdDean, 

After a few iterations on Power Automate last night, trying to get this to work, I have finally found the workflow. The workflow that you've started is correct, however, you are missing the for each and logical function to test the data. In the example below, I want to send an email when the field GridApplicationStatus changes, therefore I can cater the email for that specific attribute.

1. Add the ArcGIS trigger (when a record is updated in a feature layer - in this instance)

2. Fetch updates

3. For each (the output from previous steps will be body/items

4. Conditional - the conditional expression will look something like this: AND - Attributes/(insert your attribute here) IS NOT EQUAL TO body/Attributes/(insert your attribute here). What this is doing is taking the change log of the attribute we are testing and comparing it to the original data to see whether a change has occurred. If not change has occurred on that particular attribute, no email is sent. But if a change has happened, then vice versa. 

PDouglassEPD_0-1747728143971.png

Hope this helps

 

slehrter
New Contributor

I am working on the same thing. I want a notification only when the attribute "Status" changes from Pending to Approved. I thought I had it after seeing you IS NOT EQUAL TO example. It sends a notification when changed to Approved but also when going from Approved to Pending. Have you been able to get notifications only when set to Approved?

0 Kudos
JustPete
Regular Contributor

The only way I've managed to make it work is if there is an associated date field with the attribute domain, and so when the attribute changes to approved and approval date/time is NOW then it'll send an email. Which means that you won't get a load of emails whenever any attribute is changed.

I posted about this here:

Ability to return only change fields when update i... - Esri Community

0 Kudos