Use webhooks to automate workflows in ArcGIS Field Maps with Power Automate

1421
11
08-23-2021 10:20 AM
by Anonymous User
Not applicable
1 11 1,421

Check out this blog post where we introduce key concepts and then guide you through the ins and outs of configuring a webhook that works with ArcGIS Field Maps and Microsoft Power Automate to automate key workflows.

11 Comments
by Anonymous User
Not applicable

This isn't Esri or @Anonymous User's fault, but it should be noted that the HTTP action on which this whole workflow stands is not available to all users of Power Automate by default. HTTP is a premium action.

RyanCooper5_0-1629750632042.png

 

by Anonymous User
Not applicable

That's a good point @Anonymous User. I added a note to the blog post about that.

erica_poisson
Occasional Contributor III

@Anonymous User  -

I am making my way through your blog on how to set this up. I am curious how I would update the "Parse Edits" step's JSON to include specific attributes from my feature layer. Ideally, I'd like to set up the email so that it dynamically includes attribute information. I guess I am thinking like what I am able to do if I set up a webhook for Survey123. Here is an example of what I am talking about:

erica_tefft_0-1634320392782.png

I've done this for a different webhook where a survey triggers an update to another hosted feature layer. I have been comparing your JSON from the "Parse Edits" step with the JSON I use in that other webhook and just can't figure out where I'd insert something similar to call specific fields. In my other webhook, I use the following JSON to call specific attributes from the feature layer:

{
    "type": "object",
    "properties": {
        "objectIdFieldName": {
            "type": "string"
        },
        "objectIds": {
            "type": "array",
            "items": {
                "type": "integer"
            }
        },
        "WR_Case_Number": {
            "type": "string",
            "items": {
                "type": "string"
            }
        },
        "Inspection_Date": {
            "type": "string",
            "items": {
                "type": "string"
            }
        }
    }
}

 

I don't have a ton of experience in how to work with JSON, so any advice would be appreciated on where I should insert this within the "Parse Edits" step.

Thank you,

by Anonymous User
Not applicable

@erica_poissonThe easiest way is to run the flow up to that point and then get a sample response. You can then use the "Generate from sample" option in the Parse Edits action to turn the raw JSON response into the JSON Schema Spec that Power Automate requires. You can also view sample JSON responses on the ExtractChanges API doc page.

erica_poisson
Occasional Contributor III

@Anonymous User  - thank you, this worked perfectly. 

If I want to also use this workflow to generate notifications when data are edited, can I find the proper syntax to update in the Extract Changes API documentation? It looks like I should be able to... I am guessing I'd need to make changes within the JSON to do this, in addition to changing the "Change Types" parameter within the Webhook settings at the REST endpoint. 

Thank you!

 

by Anonymous User
Not applicable

@erica_poisson  Yeah in addition to altering the Change Types, you'll need to change the last section of configuring the flow:

@{body('Parse_Edits')['edits'][0]['features']['adds']}

to

@{body('Parse_Edits')['edits'][0]['features']['updates']}

This will provide the array of features that are edited.

erica_poisson
Occasional Contributor III

@Anonymous User 

This is great - thank you again. 

Last question. If I want to re-format the email using HTML, how do I format the attribute field names to call them into the email body? With Survey123 I use the syntax triggerBody()?['feature']?['attributes']?['field name'] - is it the same here, or is there documentation that can help me figure out what I should be using?

Thank you!

by Anonymous User
Not applicable

I think it will be:

@{item()?['attributes']['field name']}

Since item references a feature object. I don't have an example to test with at the moment though.

erica_poisson
Occasional Contributor III

I just tested and this worked perfectly. 

Thank you for your help, and the fantastic blog. 

SueEnyedy
New Contributor II

Hi Aaron,

Any update on when we can expect Field Maps trigger for Power automate to simply the process ?

Thanks!

Sue

by Anonymous User
Not applicable

@SueEnyedyWe've evaluated building a custom connector and determined that with the current state of ArcGIS Online and the Power Automate platform it's not feasible to build the experience everyone really wants. So at this time we have no plans to build a custom connector, but as things evolve we may re-consider.