"when a record is created in a feature layer" also triggering on feature edits

1362
5
Jump to solution
01-04-2023 02:11 PM
ahargreaves_FW
Occasional Contributor III

 @SeanKMcGinnis  I’ve performed some simplistic testing and can see the following behavior:

If I set the flow up as shown below it works as intended and only sends an email when new records are created in the feature service. 

    • When a new record is created
    • Apply to each
      • Send email

ahargreaves_FW_0-1672869593917.png

The issue with this is that we have no access to the attributes of the new feature/dynamic content.

However, if we set the flow up as shown below now it does provide access to the attributes of the new feature/dynamic content but does not work as intended. Instead it sends emails for both new records and edits to existing record:

    • When a new record is created
    • Apply to each
      • Fetch updates, changes or deletions
      • Apply to each 2
      • Send an email

ahargreaves_FW_1-1672869593925.png

Note that there as 2 payloads under ‘Apply to each 2’. Here's the RAW JSON:

FETCH ACTIONS RAW INPUTS:

{

    "host": {

        "connectionReferenceName": "shared_arcgis",

        "operationId": "WebhookGet"

    },

    "parameters": {

        "changesUrl": "https%3a%2f%2fservices.arcgis.com%xxxxxxxxxxxxxxxxxx%2farcgis%2frest%2fservices%2fMSFLOWTESTING%2fFeatureServer%2fextractChanges%3fserverGens%3d%5b829542%2c829547%5d%26async%3dtrue%26returnUpdates%3dfalse%26returnDeletes%3dfalse%26returnAttachments%3dfalse",

        "userLayer": "xxxxxxxxxxxxxxxxxxxxxxxxxlayerId0",

        "layerId": 0

    }

}

 

FETCH ACTIONS RAW OUTPUTS:

{

    "statusCode": 200,

    "headers": {

        "Timing-Allow-Origin": "*",

        "x-ms-apihub-cached-response": "false",

        "x-ms-apihub-obo": "false",

        "Date": "Wed, 04 Jan 2023 19:35:22 GMT",

        "ETag": "W/\"2d5-dilcTtnGDqgzN3ciuDdCj1NYU7E\"",

        "X-Powered-By": "Express",

        "Content-Length": "725",

        "Content-Type": "application/json; charset=utf-8"

    },

    "body": {

        "items": [

            {

                "geometry": {

                    "x": -8597754.054998333,

                    "y": 4702694.790991535

                },

                "attributes": {

                    "OBJECTID": 6,

                    "GlobalID": "ED502BB3-4B0D-4F68-A44B-0C8FD6AB7261",

                    "Name": "I am the 6th point",

                    "Category": 1,

                    "Location": null,

                    "Date": null,

                    "Comments": "this is #6",

                    "CreationDate": 1672860824841,

                    "Creator": "ahargreaves_FW",

                    "EditDate": 1672860837702,

                    "Editor": "ahargreaves_FW"

                }

            },

            {

                "geometry": {

                    "x": -8597909.317712057,

                    "y": 4702799.891905442

                },

                "attributes": {

                    "OBJECTID": 5,

                    "GlobalID": "302643AB-8565-4629-9ED1-334812D2EE4F",

                    "Name": "I AM THE 5TH POINT",

                    "Category": 5,

                    "Location": null,

                    "Date": null,

                    "Comments": "I have edited #5",

                    "CreationDate": 1672860134937,

                    "Creator": "ahargreaves_FW",

                    "EditDate": 1672860702557,

                    "Editor": "ahargreaves_FW"

                }

            }

        ],

        "deleteIds": [],

        "attachments": []

    }

}

 

Note that there are 2 items returned by the fetch action but no way to discern that only ‘point 6’ was the newly created record. ‘Point 5’ already existed and was merely edited.

Therefore, @SeanKMcGinnis how do I set up a flow to only send an email when a new feature is created that also provides access to attributes/dynamic content?

 

(For clarity I'm linking to related cross-postings here)

0 Kudos
1 Solution

Accepted Solutions
AnthonyLatini
Esri Contributor

Hello @ahargreaves_FW ! My name is Anthony and am a product engineer on the ArcGIS for Power Automate team. 

I wanted to give an update on this issue and fix. We have pushed a fix to ArcGIS for Power Automate and all tests have been completed. You should be able to run your flow again and see the correct behavior. In some cases, you might need to recreate your flow (Power Automate can be a tricky environment with caching, etc.). 

As a note, I tested this using both email responses message in Teams. Further, I also tested this using some "extreme" flows where I was updating, deleting, and creating records all within a 30 second to 5 minute timeframe. I wanted to recreate the original flow as well as some extended testing. 

Please let us know if you are seeing the original behavior that you posted or if there are any other issues that pop up! 

View solution in original post

5 Replies
AlagiriVenkatachal
Esri Contributor

Hi @ahargreaves_FW ,

We found an issue with how we are processing the changesUrl from the payload for the webhook trigger. We have a fix for it and are in the process of testing it now.

Once we have tested the fix, we hope to have it deployed soon.

 

Best,

Alagiri

ahargreaves_FW
Occasional Contributor III

@AlagiriVenkatachal thanks for the update and thanks to you, @SeanKMcGinnis  and the team for support and quick fix. Please can I ask you to post here once the fix is in place?

 

0 Kudos
AnthonyLatini
Esri Contributor

Hello @ahargreaves_FW ! My name is Anthony and am a product engineer on the ArcGIS for Power Automate team. 

I wanted to give an update on this issue and fix. We have pushed a fix to ArcGIS for Power Automate and all tests have been completed. You should be able to run your flow again and see the correct behavior. In some cases, you might need to recreate your flow (Power Automate can be a tricky environment with caching, etc.). 

As a note, I tested this using both email responses message in Teams. Further, I also tested this using some "extreme" flows where I was updating, deleting, and creating records all within a 30 second to 5 minute timeframe. I wanted to recreate the original flow as well as some extended testing. 

Please let us know if you are seeing the original behavior that you posted or if there are any other issues that pop up! 

ahargreaves_FW
Occasional Contributor III

@AnthonyLatini , @AlagiriVenkatachal  & @SeanKMcGinnis  initial testing of the fix shows it's working as expected and only NEW features are triggering the flow, not updates to existing features.

Thank you all very much for the rapid update.

ahargreaves_FW_0-1673373471333.png

 

SeanKMcGinnis
Esri Contributor

I am glad it is working as expected and appreciate you working with us as we figured out the best solution. As always, you know where to find me if something comes up in the future.

-sean
Sean McGinnis - ArcGIS for Microsoft 365 Product Manager
0 Kudos