Select to view content in your preferred language

Generate Feature Report in Power Automate

14058
36
Jump to solution
07-07-2021 02:56 PM
Bryan_Wade
Frequent 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 Frequent Contributor

I would imagine so, but unfortunately I am not sure off-hand what those changes would be as my environment is fully Enterprise.

As a potential alternative, Integromat has pre-built flows for generating a feature report. I understand that may not be an option for a lot of businesses though.

Sorry I couldn't be of more help on this one.

0 Kudos
StacyLynnBlanco
Emerging Contributor

Unfortunately, I am in the situation where Integromat is not an option. I'll keep trying and see if I can get it to work. Thanks again for the detailed instructions.

 

0 Kudos
AdminAccount2
Frequent Contributor

Thanks for posting that. I recreated that flow and everything works - except if the report template contains a geopoint type question, then it fails with:

 ["An error occurred when rendering by the report engine.  Failed to print map for `$map_geopoint`.  waiting for function failed: timeout 180000ms exceeded"]

If I remove the geopoint question from the MS Word feature report template, then it works fine and generates the report from the Flow API request. When the geopoint question is included, the report generates normally without error from the Survey123 web site, but fails if called from the Flow API.

I have already opened a support request with ESRI on this issue, but so far we have been unable to resolve this. The query works and everything is returned, but it seems like it cannot access the map used for printing the geopoint in the MS Word feature template. 

We have tried  many things to to resolve this, including adding the webmapItemId and mapScale parameters and trying different formatting of the request within Flow and also using Postman, but nothing seems to work when a geopoint question is included.

Just wondering if you or anyone else has tried including a geopoint question in the MS Word feature report and then using the API request from Flow to generate the report.  Has anyone successfully done this, had similar issues or found a way to resolve this problem? I'm testing with a report template that is very basic - one question and one geopoint... no repeats or anything.

0 Kudos
abureaux
MVP Frequent Contributor

Right. That... I forgot about that. That is a bug.

I noticed this a while ago as well. Took me a bit to figure out that the geopoint was the issue when handled by Power Automate since the template worked fine when printed through the Portal and this feature used to be supported in Power Automate.

A recent(ish) update from Esri broke something, so geopoint questions seem to cause the error you described above. I removed my geopoint questions a while back to get around this bug. I have been meaning to contact Esri Support to report the issue, but it slipped my mind.

If you are using Portal 10.9 (like me), there aren't many other options. If you are still on 10.8.1 or earlier, you can try Integromat. It may still work with geopoint questions. I cant really test though as it doesn't work at all in 10.9 ><

Sorry I couldn't be more help on this one. Hopefully they can identify the issue and fix it. I miss geopoints...

0 Kudos
AdminAccount2
Frequent Contributor

Thanks for that reply. I'm testing this process using AGOL instead of Portal, but it sounds like exactly the same issue regardless. You indicated this process used to work fairly recently - I'm guessing it broke sometime around September 16, the last major AGOL update by ESRI -  does that sound about right?

If so, maybe we can pinpoint the issue to something that occurred in that last ESRI update. I'm working with tech support and will post updates to the issue as received.

0 Kudos
abureaux
MVP Frequent Contributor

I believe it was before that update. Looking back through my records, there was an update on July 29, 2021 that caused me a lot of grief. It was sometime after that when I started removing the geocode questions...

If I were to go off of my Word document's time tags, I have a template with a geocode question on August 19, and a subsequent template without the geocode question that same day. So, looks like I noticed the issue in mid August.

abureaux
MVP Frequent Contributor

As I am dealing with this right now, it triggered me that I should probably post this here as well. The second major limitation that I have encountered (the first being geopoints not working), is that "Edit and resend" does not seem to trigger Power Automate for me even with the switch checked in the webhook on the Portal. Integromat did work with this feature though. I am unsure if this is Power Automate, Esri, or our Portal acting up though. I will likely open a formal case tomorrow as this one is pretty annoying. (I actually already had a case open for this for a while. Just forgot about it because it had been so long)

(I have told people to use "Copy data to a new survey" in the meantime. As this acts like a new submission, it does trigger PA)

Edit: After I went back to check on this feature to update my case, it appeared to be working again. I am guessing that something in the 3.13 update (or a more recent update by Esri behind the scenes) fixed whatever was causing this problem for me.

AdminAccount2
Frequent Contributor

Thanks abureaux. Can you please post the results of your findings with ESRI Support on the Edit & resend issue? I'm sure I'll be running into that too at some point. 

ESRI Support has diagnosed the issue with the geopoint question and provided a workaround. It has been recorded as a bug, and I have escalated it.
#BUG-000143518 Trying to run createReport Request using a token from the generateToken Request Fails

The issue is with the token. Using the generateToken API request fails to provide a valid token to access the map required for the createReport function, it only works using the token that was included with the survey submission.

So the workaround is to use the token that's included with the submitted survey, not the one created from the generateToken API call. Instead, use the value of Portal Info Token that's included with the survey submission. It works, (it will create the map if a geopoint question is included in the template) however there are some caveats that make it less than ideal. This token expires in 15 minutes, so it's not going to work if your automated report generation is on a schedule longer than that, and if the process fails the token will not be valid for resubmitting. Also, since the token is included as part of the survey submission, it's using the submitters permissions to access and generate the report, meaning that all submitters MUST be included in a group that can access and view the surveys (Share Results in the web app), and the history of the report generation will only be available from the Survey123 web app when logged in as that user.

In our environment this workaround is not really feasible. Hopefully the escalated request to resolve this bug will be implemented quickly.

AdminAccount2
Frequent Contributor

Thanks to James Tedrick at ESRI - the solution to the issue we were having generating reports using the Create Feature Report API in Microsoft Power Power Automate has been resolved. The issue was a bit difficult to diagnose, since everything worked as expected except when a geopoint question was included in the report template, then it could not render the map on the report and the process would timeout.

The solution is to make sure the generateToken API request in the flow includes the value referer=https://survey123.arcgis.com

generateToken.jpg

0 Kudos
abureaux
MVP Frequent Contributor

I just finished a form that requires a map, so this is very good news indeed!

However, I feel like something may have changed behind the scenes with either Esri or Power Automate? When I went to check my set-up, I already had the referer set (also visible in my post above):

abureaux_1-1643309981340.png

I did a test with my automation as-is, and the print (including a map) didn't time out! I'm very excited to have this capability again.

0 Kudos