Generate Feature Report in Power Automate

12783
36
Jump to solution
07-07-2021 02:56 PM
Bryan_Wade
Occasional Contributor

Does anyone know if the ability to generate Surevey123 Feature Reports using Power Automate has been fixed? I've used the work arounds described in previous posts but some of my surveys are getting a bit complicated to continue to do that.

36 Replies
abureaux
MVP Regular Contributor

Opps, my apologies. Give me a min to grab the JSON. I will edit the above post.

...the text was being annoying, so I was going to toss those blocks into text files and attach them, but then things started working again and I must have missed this one.

0 Kudos
abureaux
MVP Regular Contributor

Hmm. Says my post will be edited after moderator approval. Not sure how long that takes... I'll just leave that missing JSON here in the mean time:

 

{
    "type""object",
    "properties": {
        "jobId": {
            "type""string"
        },
        "jobStatus": {
            "type""string"
        },
        "submitted": {
            "type""integer"
        },
        "completed": {
            "type""integer"
        },
        "resultInfo": {
            "type""object",
            "properties": {
                "title": {
                    "type""string"
                },
                "totalCount": {
                    "type""integer"
                },
                "resultFiles": {
                    "type""array",
                    "items": {
                        "type""object",
                        "properties": {
                            "objectIds": {
                                "type""array",
                                "items": {
                                    "type": [
                                        "integer",
                                        "string",
                                        "number"
                                    ]
                                }
                            },
                            "name": {
                                "type""string"
                            },
                            "size": {
                                "type""integer"
                            },
                            "url": {
                                "type""string"
                            }
                        },
                        "required": [
                            "objectIds",
                            "name",
                            "size",
                            "url"
                        ]
                    }
                },
                "succeededObjectIds": {
                    "type""array",
                    "items": {
                        "type""integer"
                    }
                },
                "failedObjectIds": {
                    "type""array"
                },
                "details": {
                    "type""array"
                }
            }
        },
        "inputInfo": {
            "type""object",
            "properties": {
                "jobType": {
                    "type""string"
                },
                "parameters": {
                    "type""object",
                    "properties": {
                        "featureLayerUrl": {
                            "type""string"
                        },
                        "queryParameters": {
                            "type""object",
                            "properties": {
                                "objectIds": {
                                    "type""string"
                                }
                            }
                        },
                        "templateItemId": {
                            "type""string"
                        }
                    }
                }
            }
        }
    }
}
JulieK
by
Occasional Contributor

@abureaux - Thanks for the workflow. I am trying to send out a report when a certain field is updated in a feature service(Survey123 fs). The feature service when edited does trigger the flow, but I get an error 'cannot read property 'username' of undefined' when it gets to step 7 in your workflow. The survey isn't shared to everyone but the flow user has access to the survey. Is this workflow only possible when survey123 is triggered?  Any thoughts? 

abureaux
MVP Regular Contributor

Hi Julie,

Sorry, but I'm not sure off-hand. I haven't tried a flow with the feature service as the trigger. I also haven't gotten that error before (at least in that context. I have seen it before, but only while editing the flow. The solution was to re-authenticate a Data Connection). It may be related to the trigger not containing all the necessary data? If it is failing on the "Check Template" step, I would start by checking the values for formItemId, featureLayerUrl, formItemI, and token. That step is really just formatting a URL though. So it's strange that is got passed the Generate Token phase and failed there. Maybe also check that you are using the same Data Connection?

 

kelin84
New Contributor III

Thank you for your time and effort to share this with us all. This is very useful. It's going okay, until the HTTP in the "Do until" section. I can't really see what comes in to add this error:

"messages": [
    "500: Object ID 'objectid' is not valid."
  ]
 
and why it's failing in that part, afterwards it gives me the same error all the way down.

Do you know where I could look?
Again a big thank you for sharing this.
0 Kudos
ISP_graynic
Occasional Contributor II

@abureaux Pardon my ignorance on this, but are the "Add an HTTP" steps, separate Flows? It will only let me have one trigger per Flow so I think I'm doing something wrong since the trigger is when the survey response comes in.

0 Kudos
abureaux
MVP Regular Contributor

No worries! It can be confusing.

What I have posted above is one single flow* and all the steps, including "Add an HTTP" steps, are included in that flow under a single trigger.

*I actually recommend splitting this one flow up into two flows. I will likely start a new thread on this soonish.

My full flow looks something like this. Please note that this is NOT the flow I have posted above, so don't try to compare this image line-for-line with the above steps as there may be a couple small variations. I just wanted to show a screen cap of the full flow which includes the HTTP steps.

abureaux_0-1643316501755.png

 

The "Add an HTTP" step I am referencing above is this:

abureaux_2-1643316735489.png

 

Does that help at all?

ISP_graynic
Occasional Contributor II

Thank you very much! I was trying to add the Http "Trigger" rather than the Http "Action" which was throwing off my flow. I only saw it under the Triggers list earlier but now if I scroll way down I see it as an Action option also. Thanks again for creating this. It would be great if ESRI was able to get the feature report flow added to Automate like the one that exists within Integromat. 

abureaux
MVP Regular Contributor

Glad you got it to work! I agree that having the basic flow in Power Automate would be very helpful for people.

Once you get familiar with it though, I 100% recommend splitting all S123 flows in Power Automate into two separate flows for redundancy. That way, random report generation failures or other service interruptions can be autocorrected without any further effort on your part! (Again, I'll likely start a new post on this soonish)

StacyLynnBlanco
New Contributor III

Thank you so much for providing such detailed instructions. I am fairly new to this, so I was wondering if you might be able to help me figure out how the HTTP sections would change for AGOL instead of Portal? I'm struggling with the syntax.

0 Kudos