Power Automate - Basic - V3
Power Automate - Basic - V3
Table of Contents
Power Automate and Survey123 ..................................................................................................................................................... 1
Basic Flow Set-up ........................................................................................................................................................................ 1
1. Preface ............................................................................................................................................................................ 2
2. Quick Power Automate Overview ....................................................................................................................................... 2
3. Service Accounts ............................................................................................................................................................. 3
4. Survey Requirements ....................................................................................................................................................... 3
5. Custom Connection ......................................................................................................................................................... 3
6. Save As You Go ................................................................................................................................................................ 3
7. The Flow .......................................................................................................................................................................... 4
8. High-Level Overview ....................................................................................................................................................... 13
Appendix I – Fixing an old Custom Connection ............................................................................................................................. 14
Appendix II – Webhook settings ................................................................................................................................................... 15
Appendix III – Custom JSON ........................................................................................................................................................ 16
Appendix IV – templateItemId ..................................................................................................................................................... 17
Appendix V – Template in Power Automate ................................................................................................................................... 18
Appendix VI – Special Notes ........................................................................................................................................................ 19
1. Preface
My flows for S123 are split into two parts: Stage 1, and Stage 2. This is primarily to support error handling to ensure a highly reliable
corporate environment.
I have both stages saved as “Templates”, and all subsequent flows I make are based on these two templates by saving a copy of the flow
and then editing that saved copy (see Appendix V – Template in Power Automate for more details).
This is only a basic guide and will cover a single-stage flow for generating reports. I plan on releasing a more comprehensive guide in
the future that covers the two-stage flow mentioned above.
I would consider the flow described below to be very basic. It serves as a good introduction to Power Automate and Survey123 but is not
something that I would deploy as a large-scale corporate solution.
1. New flow – This is where I start new projects if I am starting from scratch.
2. My flows – Contains all your flows. I typically spend most of my time on this tab.
3. Connections – Enterprise users like me will need this more often than AGO users. Go here to update login credentials or
refresh connections.
4. Custom connections – Again, Enterprise users will care more about this than AGO. You need to go here to create the Custom
Connector mentioned in the Custom Connection section.
5. List of Flows – This is a list of all your flows ordered by Modified date. At this time, the order method cannot be changed.
1
For more information, try https://learn.microsoft.com/en-us/power-automate/getting-started
1. Insert a new step – Hovering over an arrow allows you to add an Action between two existing steps.
2. Dynamic Content – When you click into a field, you get a popup. Dynamic Content is selected by default, and it contains a list
of all dynamic content from your Flow’s Trigger as well as every Action above the Action you are configuring.
3. Expression – Allows you to write Expressions. E.g., utcNow() returns the current time.
4. Add an action – The same as #1, but at the bottom of groups and with slightly different terminology.
5. + New Step – The same as #1, but at the bottom of the page.
6. Context Menu – Allows you to configure Run After settings (e.g., error handling) as well as action-specific settings (e.g.,
maximum loops).
3. Service Accounts
You need an account to log into Power Automate, and Power Automate requires an external account to set up a connection to your
Portal. I highly recommend that you set up a service account for both. I also highly discourage the use of a named user for those
service accounts (I mean, if they are a named user, they aren’t service accounts anyway). E.g., If Fred’s personal account is holding
everything together and Fred decides to get a new job, have fun swapping all of Fred’s services to a new account! vs. You use an
unnamed service account to hold everything together and Fred gets a new job, you at least don’t have to worry about services failing
when IT inevitably disables Fred’s account!
4. Survey Requirements
Not applicable for a basic implementation.
5. Custom Connection
This step is the only real difference between AGO and Enterprise now…
AGO, skip this step.
Enterprise, follow the instructions in the Knowledge Base (KB) article below.
Create an ArcGIS Survey123 connector for Microsoft Power Automate for use with ArcGIS Enterprise
ATTENTION: To Enterprise users with per-existing Custom Connections, your connection may be out of date. If that is the case, you WILL
NOT see the new “Create report” connector. To fix that, see Appendix I – Fixing an old Custom Connection.
6. Save As You Go
Sometimes things go wrong in Power Automate and you can’t edit your flow properly, meaning your only course of action is to refresh the
page and lose all your unsaved work. Power Automate does NOT let you save a flow if there are ANY errors in it.
This is a huge limitation/liability when working on new projects, and hopefully it will change in the future.
So… save your work regularly!
7. The Flow
Start a new blank flow. The fastest way is: + New flow > Instant cloud flow > Skip
In the top right corner, you may see the “New designer” toggle 2. Toggle this OFF3.
+ Trigger
AGO: Search for “survey123” and choose “When a survey response is submitted”.
Enterprise: Select the Custom tab and click “When a survey response is submitted”.
2
This button tends to move around the page as Microsoft progresses their testing of AI and flows, so it may have moved by the time you
are reading this.
3
I always turn this off for two main reasons: 1) It doesn’t work for complex flows, which most of mine are, and 2) I find it clutters the
screen.
Now that your trigger has been added, you need to select a survey for it to point to. As soon as you save and turn ON this flow, a
Webhook will be created for whatever survey is listed here (check out Appendix II – Webhook settings for some more info).
I suggest you set this flow up as a template by selecting a survey that is always present, but never used (see Appendix V – Template in
Power Automate for more details). In my case, I have a “Demo Form” that I keep around for general testing and saving random
features/content. This is “my” survey that only I use, and so it perfect for this role.
When you save and turn ON a flow that uses the “When a survey response is submitted” Trigger, whichever survey you have selected in
the dropdown will have a pending update in the Field App. Users must download this update for their survey submissions to trigger the
flow.
Using a “dummy” survey to fill this dropdown is a nice buffer in case your template ever gets mistakenly turned ON. With such a set-up,
no “live” surveys will ever be affected by such an eventuality.
+ Initialize Variable × 2
Format the variables as per below.
The only thing you need to change here survey-to-survey is the Value for surveyName. I recommend that this be both unique and
recognizable. E.g., I used “DEMO” for my Value in this demonstration. If I ever see “FLOW FAIL - DEMO” in my inbox, I will know exactly
what survey that email is for (I’ll cover the “FLOW FAIL” component below).
While I typically don’t name unique steps like Triggers, it is important to name all steps of your Flow for clarity. I recommend leaving the
default text and just adding onto the end. E.g., “Initialize variable – jobStatus” rather than “jobStatus”.
+ Scope
We are working within this scope until specified otherwise! This is a big part of error handling.
By the way… In subsequent steps, you will notice that I try to leave a “cookie trail” for you, so you know where to put things. You can
check my screen caps to see what I ended up naming my different steps. For example, I named this first Scope as “Scope – Report”. This
is what I use in my “cookie trail” below! Feel free to name your steps whatever makes the most sense to you though.
Field Value
Method GET
URI Search Dynamic Content for “url” from your Create Report step.
ATTENTION: I will only mention this ONCE, but it will come up several more times in the flow! You will see duplicates of many values
from Esri’s “Create report” step, such as “url” pictured below. Esri added the “… of the first result file” options specifically for use in your
flow. The other option should be disregarded entirely.
Why, you may ask. Because the “Create report” step is actually a loop. Let’s put this in the context of Survey123: the Create Report step
is a Repeat, “url” is inside the repeat, and “url of the first result file” is outside the repeat. If you select a value that exists within a Repeat
(aka, an array) within Power Automate, it tries to be smart and will add that step you are working on in an “Apply to each”.
+ Scope – Report > Set variable
Field Value
Name Search Dynamic Content for the “jobStatus” Variable.
Value Search Dynamic Content for “jobStatus” from your Create Report step.
+ Scope
This is our second Scope, and our first error handler.
Just copy-paste the above text into the Expression field and click OK
If you have multiple email accounts added to Power Automate, keep in mind that every time you add a “Send an email” step, Power
Automate defaults to the first email in the list alphabetically. You will have to manually change it each time by going into the Context
Menu.
Configure the Run After for Scope – Report Fail to be the following:
+ Condition
Conditional values are case-sensitive! Ensure you enter esriJobSucceeded exactly as shown.
This step is very important because of how the Create Report step functions. Basically, if something goes wrong on Esri’s end while
generating your report, Esri will still successfully pass along that failure notice to Power Automate. As a result, the Create Report step
within Power Automate will succeed! Consequently, you need to manually tell Power Automate that something went wrong.
Configure the Run After for Condition to be the following:
Field Value
Attachments Name -1 Search Dynamic Content for “name” from your Create Report step.
Attachments Content Search Dynamic Content for “body” from your HTTP – Get Report step.
Don’t forget to also rename the “Send an email” and “Terminate” steps.
☺ Done!
This is it!
You should now have a basic flow to generate a Feature Report upon survey submission, and then email that Feature Report.
8. High-Level Overview
Appendix I – Fixing an old Custom Connection
If you have a pre-existing Custom Connection for Power Automate that does not have the new Create Report action, you have three
options:
1. Replace your old Custom Connection with a new one [Not Recommended]. That also means you must update every flow that
used the old Custom Connection, and all your users need to update all their surveys to get Power Automate working again.
2. Have two Custom Connections running side by side [Not Optimal]. Probably the lowest effort solution. There is no user impact
here unless you need to update an old flow to use the new Custom Connection. You will end up with a mix of flows using the
new and old Custom Connection.
3. Update your old Custom Connection [Recommended]. A little more complex, but has zero user impact, and all old Custom
Connections are automatically updated.
Procedure:
1. Follow along in Esri’s Guide until Step 5, then return here.
Attention: When I tried to recreate this step, I ran into an odd error. I was unable to save my Custom Connection, and kept getting
“Description must be written in English”. While I don’t expect that this error is common, if it crops up for you, here is the solution:
Delete all of Esri’s text from the Description text box and paste in plain text (no numbers or special characters). Just be sure you have at
least 30 characters in the text box, or you will get another error telling you to add more characters… Ultimately, I just copy-pasted
“Description must be written in English.” Into the Description text box several times. Problem solved.
2. Open your new Custom Connection in one tab, and your old Custom Connection in another.
3. Go to 3. Definition in both tabs
4. Toggle ON Swagger editor
There is likely only one webhook. However, each time you save a new flow that uses the “When a survey response is submitted” Trigger
(and turn it ON), a new Webhook will be created. My “Demo Form” that I use as a Power Automate template has 20 or so webhooks…
another excellent reason to have a template set-up like I describe here!
If you were messing around in Power Automate and have a bunch of Webhooks, you only have a single flow, maybe just delete all the
extra Webhooks.
5. All items are checked by default, except for “Existing record edited”. If you are allowing records to be edited, ensure that you
check this ON
Appendix III – Custom JSON
At minimum, you need two steps:
1. When a survey response is submitted Custom Trigger; and
2. Literally any other step so Power Automate saves and runs (I typically use Compose with the Trigger Body for content – but it
doesn’t really matter).
Steps:
1. Select the survey you would like custom JSON for
6. Go to VS Code and paste the JSON into a new file. At minimum, you should change all the values to null (this will save you from
errors and headaches later). Beyond that, I also recommend stripping out anything you don’t plan on using since it makes
working in Power Automate simpler.
If you are working with repeats, you may wish to also leave the uniquerowid and parentrowid fields. Depending on your task, these may
be critical to eliminating duplicate entries or entering data into a database.
Appendix IV – templateItemId
6. Go to the Surveys Website (https://survey123.arcgis.com/surveys)
7. Select the survey you are working on and go to the Data tab
8. Click Report
9. Upload a Feature Report, if one is not uploaded already
10. Physically select the Feature Report from the dropdown menu. Do this even if the Feature Report you want already appears to
be selected… because it isn’t (for this purpose).
11. Look at your URL, the templateItemId for that Feature Report is there
Appendix V – Template in Power Automate
When I talk about templates in Power Automate, I am not referring to the “Templates” page, but rather flows I have set up in the “My
flows” page with placeholders (e.g., “Demo Form” as the Trigger, as I describe above) and leave turned OFF.
When I want to use one of these “templates”, I go More Commands > Save As, and then edit the copy. This allows me to set up new
surveys with a robust and functional flow in just a few minutes.
Appendix VI – Special Notes
This is just a space for me to add miscellaneous notes that don’t fit anywhere else. I will add to here as I remember things.
1. Sometimes when you search for a variable in Power Automate, it will not appear. This is a bug. You can circumvent this bug by
doing the following:
a. Go to Expression and type =
c. Scroll through Dynamic content and locate the missing variable. (This fix will disable type-to-search but WILL show all
the missing variables).
2.