Select to view content in your preferred language

Survey123 Enterprise and Power Automate to Create Report, Upload, Email

1475
4
06-30-2023 04:57 AM
BrendonJoyce1
Occasional Contributor

Good morning all,

 

I have been scouring forums and have not been able to find a straightforward answer to see if people are able to use Enterprise Survey123 and Power Automate to Create report, upload to OneDrive, then email as an attachment.

I have the custom connector working and see the dynamic options for creating reports, etc. The problem is when it goes to upload file from URL. Using the Esri strategy for the AGOL of URL from first result of create report from this thread  ends up giving an error for "a value must be provided for source path"

It seems like it cannot pass through the URL correctly. I have tried adding in the ?token=Portal Info Token as well, but that just spits back the actual token and I don't see the file, still giving error. Can this be done without the HTTP models I've seen in other posts?

Thanks!

 

0 Kudos
4 Replies
AlexBakhtin
New Contributor III

Not sure if you were able to work this out but we use a similar workflow internally for some Survey123 items published to our ArcGIS Enterprise. With regards to a few of our setups, we use this simple flow:

  1. When a survey response is submitted
  2. Create report
  3. HTTP (this is used to obtain the attachment and the critical part of our flow)
  4. Send an email

For the HTTP setup, you will need to use the GET method with url for the attachment (in the screenshot). Then you will need to use the body of the HTTP request as the attachment for email/file upload/etc...

AlexBakhtin_2-1689180659163.png

AlexBakhtin_3-1689180802780.png

You can also have a branching flow where once you do the HTTP request, branch to send an email and upload to OneDrive. Hope this helps!

Alex Bakhtin
0 Kudos
BrendonJoyce1
Occasional Contributor

Hi Alex, thanks for the response. This seems like it should work in theory but HTTP is blocked by my org, hopefully I can work that out with them

It seems as though the create report is not working correctly for me. Even if you get the dynamic expressions, what are you using for Feature layer and report template? It seems like these need URLs for Enterprise. 

Does Feature Layer get a full portal service URL, even with the /0 at the end?

Does the Report template need the full portal service URL as well or just the name of the docx form?

 

 

I get this error for Create Report - it can see the report name, but it is not generating the report...

{
  "error": {
    "message""Layer specified by featureLayerUrl does not exist or is not accessible.invalid json response body at https://xxxxxx.com/portal/sharing/rest/info reason: Unexpected token < in JSON at position 0",
    "code""102",
    "details": [
      "invalid json response body at https://xxxxxxx.com/portal/sharing/rest/info reason: Unexpected token < in JSON at position 0"
    ]
  },
  "success"false
}

 

 

0 Kudos
BrendonJoyce1
Occasional Contributor

Conversely, if I only use the id's, it gives a different error. 

 

 

0 Kudos
AlexBakhtin
New Contributor III

I can't think of a way to get the attachment without the HTTP GET method so that will be necessary. That being said, is the ArcGIS Enterprise account that you are signed in with for this connector the same one that owns the survey? When you select the name of the survey it should automatically populate the dropdown for possible feature layer name options instead of you having to put it in yourself. That should also be the same for the report template:

AlexBakhtin_0-1689682811723.png

AlexBakhtin_1-1689682894446.png

That being said, I checked the raw inputs after running a successful flow and this is how it looks. I removed some identifying information and formatting but the inputs below relate to the survey, feature layer, report template, object ID, report name, and format.

"createFeatureReportBody/surveyItemId": "ff127403680347ae919d85dc5a9e7299",
"createFeatureReportBody/featureLayerUrl": "https://host.domain.com/webadaptor/rest/services/Hosted/service_72d20d8501914ec6a518756b5468159a/FeatureServer/0",
"createFeatureReportBody/templateItemId": "7eaaa8c49c1d4258a44d2b3de05fb778",
"createFeatureReportBody/queryParameters/objectIds": 214,
"createFeatureReportBody/outputReportName": "Site Checklist",
"createFeatureReportBody/outputFormat": "pdf"

 

Alex Bakhtin
0 Kudos