Select to view content in your preferred language

Automating Survey123 Reports through Power Automate

1672
8
Jump to solution
08-30-2023 07:07 AM
PaulLefaive2
New Contributor II

I'm using the 'When a survey response is submitted' trigger followed by a 'Create Report' action in a Power Automate flow. Survey123 form is hosted on ArcGIS Online (published through Survey123 Connect).

Essentially when a survey is submitted, based on some conditions the Survey123 Reporting service is called to generate a PDF report for the submitted record and then emailed as an attachment to an email address.

For the most part, this flow has been working relatively well (there are minor hiccups from time to time). One of the major issues I've run into with this setup I believe is with the Token duration. It appears like clock-work that every 14 days I need to re-authenticate the 'Create Report' action connector.

I've set re-occurring calendar  reminder to login and re-authenticate but it would be nice if this inconvenient limit could be lifted. Not sure if others have run into this.

@Ismael (or anyone on the product team) I was wondering if there are plans to work with Microsoft to remedy this? 

Thanks

1 Solution

Accepted Solutions
Ismael
by
New Contributor II

@PaulLefaive2  The token expiration happens after 14 days.  The issue is very hard to resolve as it involves dramatic changes to the architecture of the connector.  We are evaluating our options which include creating a new connector or incorporating the Survey123 actions and triggers into the ArcGIS connector.  This will take a while to get resolved.  For now, what I suggest is that you keep a single Survey123 connection in your Power Automate account and use that with every single flow you create.   That makes it much easier for you to refresh the connection every other Friday.  It is a real pain.

View solution in original post

8 Replies
Ismael
by
New Contributor II

@PaulLefaive2  The token expiration happens after 14 days.  The issue is very hard to resolve as it involves dramatic changes to the architecture of the connector.  We are evaluating our options which include creating a new connector or incorporating the Survey123 actions and triggers into the ArcGIS connector.  This will take a while to get resolved.  For now, what I suggest is that you keep a single Survey123 connection in your Power Automate account and use that with every single flow you create.   That makes it much easier for you to refresh the connection every other Friday.  It is a real pain.

PaulLefaive2
New Contributor II

Appreciate the reply @Ismael!

I understand these things are not always easy to resolve. Happy to hear Esri is working towards a solution.

The value our organization gets from the automated survey123 pdf reports outweighs the inconvenience so I'm happy to re-authenticate every couple weeks until a permanent solution is released.

RobertAnderson3
MVP Regular Contributor

My understanding is that it wasn't an issue with the Survey123 trigger because when a survey is submitted the payload sends a token with the data right? Is there any way this could be used for the Create Report function, at least for flows like this example (and most of my cases) that are triggered by a survey submission anyways? Or is that still a large change in the architecture?

I hope to hear more updates on this limitation soon, thanks!

0 Kudos
IanGallo
Occasional Contributor

Hey @PaulLefaive2 It sounds like you got this to work! I took a look at it when it was first released and even got on the phone with an esri rep and a ms automate rep and they couldn't get it to work. Could you share what your flow looks like? If you could share a copy with me directly via automate that would be amazing (ian.gallo@wi.gov). Any help is appreciated! 

0 Kudos
j-bromp
New Contributor III

Hey Paul,

I'm wondering if you could give me a hand. What I am trying to do is exactly this:

"Essentially when a survey is submitted, based on some conditions the Survey123 Reporting service is called to generate a PDF report for the submitted record and then emailed as an attachment to an email address."

I am able to generate the report and have it save into one drive, i am also able to receive an email when the flow is completed however I'm not sure who to add the created pdf report as an attachment to the email?

0 Kudos
RobertAnderson3
MVP Regular Contributor

@j-bromp If you've gotten it uploaded into OneDrive, and got the email sending, you're super close!

The step in between is Get file content using path. In this box the File Path will be the dynamic content Path from the Upload file from URL that you used to put the file on OneDrive.

Then in the advanced options for the Send an Email there is an attachments section, put in the name for your attachment (I usually use the dynamic content name of the Survey123 report, and then the Attachments content will be the Body dynamic content from the Get file content using path action.

Hopefully this helps!

0 Kudos
PaulLefaive2
New Contributor II

@j-bromp  in the attachments section of your email connector (in my case I'm using Outlook) you'll want to reference the OneDrive filename and file content. Below is screenshot of what my attachment parameters are for attaching a OneDrive file to the email. Hope this helps.

PaulLefaive2_0-1714400711337.png

 

0 Kudos
j-bromp
New Contributor III

Thanks guys @RobertAnderson3 @PaulLefaive2 ,

Have got this working :). Ended up using the http get method and including that in the attachment for the email.