|
BLOG
|
I work for a local government with an Office 365 subscription that includes Power Automate (aka MS Flow) and I wanted to see what I could do with it. After Zoltan Kovacs posted his 3rd blog on using Power Automate to send an email using HTML from a survey I was talking with my colleague (a developer) who told me that it was possible to generate a PDF from HTML using Power Automate (PA). Wow! Really? It's true. It's possible. There is a convert file action that will convert HTML to PDF. The Survey123 Feature Report generates a nicer output and it includes attachments and its much easier to create a Word doc template than it is to create HTML. My method does not include attachments from Survey123 because it hasn't been exposed to Power Automate by Survey123 yet. My method also requires you to know HTML and CSS because you will need to fiddle with it. You can save a Word document as HTML (two options, more on that later) to get started but I just went old school and typed it out. Here is the flow. You will notice the second step is cut off. It is a parallel branch that would have been too wide to capture and see it. I'll explain my steps here and include tips along the way. Step 1 is where you trigger the flow with your survey. Tip: Any step or action you add to your flow can be renamed. Clicking on the 3 dots on the side will show a drop down menu. Rename is one of them. Adding comments is another. Step 2: parallel branch where I initialize and set variables inside a switch case operation This survey records water meter replacements. The choice value is stored with a code. I wanted the report to show the label and not the value. I know that Survey123 has jr:choice-name but I built this survey 3 years ago and I didn't want to change it. I looked at using a SharePoint list to lookup the value but I couldn't figure it out (I felt like I was this close to a solution! but I had to walk away and move on). I tried using the If expression as it seemed similar to the If expression in Survey123. However, unlike Survey123 it cannot contain nested expressions. There is a switch case operation. My solution was to initialize a variable and then use the switch case operation to set the variable to a nice looking label for every value. The reason why I cannot show the entire parallel branch in the screen shot is because I have 4 branches and each branch has 4 switch cases. Two of the switches have multiple cases (17 in one of them!). It is wider than my screen can show when I click into them. Tip: Have all of your parallel branches figured out in the beginning because it is currently not possible to add one in later without needing to redo your entire flow. Step 3 and 4: Read part 2 from Zoltan Kovacs for how to set this up. Step 5: Create the HTML file (add step: create file action in OneDrive for Business) A side note about HTML: It's the trickiest part because … well … it is HTML. While testing I typed the HTML myself because I wanted a simple form. I did have a Word doc of this form. In Word, if I saved it as web page, opened it in Notepad++ it was over 1300 lines long! If I saved it as a web page filtered it was about 300 lines long. Filtered means it strips out all of the Word tags making it impossible to turn it back into the same Word document again. A side note about challenges using the PA user interface: This report I created is not very long. About a half of a letter sized page. However, I was unable to see all of it in the PA interface. One of the challenges with the interface is that the dynamic content is in a floating window all of the way down at the bottom right. It doesn't follow you as you scroll up. If you want to insert the content you have to mouse click exactly where you want it, scroll down, click on the content and then scroll back up to see if it put it where you want it. If you didn't mouse click exactly (even if you think you did) it will appear at the top of the file content. While it is possible to click on the dynamic content and drag it up through the file it is slow and it may need to be done multiple times to get it where you want it. The next screenshot is the beginning of the HTML. The folder path is where the HTML file is saved in OneDrive for Business. This is one of the connections you need to set up in advance. I believe you cannot go deeper than one folder off of the root folder. Tip: I found that it was possible to insert code in the HTML while using Notepad++. For example, the dynamic content for anything from Survey123 is triggerBody()?['feature']?['attributes']?['field name']. In Notepad++ I used @{triggerBody()?['feature']?['attributes']?['field name']}. Once it was copied into the PA window it changed into the normal looking green dynamic content. Tip: I'm using inline CSS but it is possible to reference an external stylesheet. I have not tried this yet. The file name can be a dynamic value. I was never able to figure out how to do this in Integromat. The green icon with the checkmark is coming from the survey. In this particular case it is the service address. I added .htm PA uses different colors for dynamic content. So far I've seen green for Survey123, blue for the built-in functions used to generate the time stamp and purple for the variables I set. Step 6: Create the PDF file When you create the file in Step 5 from above the dynamic content will now include ID. It is all that is needed for this step. Step 7: Save the file to OneDrive When the HTML file is created in Step 5 it actually saves the file to OneDrive. That doesn't happen in Step 6. You have to explicitly save it using the Create File operation (I've already renamed it in this screenshot). Choose the folder and add the file name and file content from the dynamic content window. Step 8: Send email (V2) preview I didn't really have to send an email to myself with the attachment as it was saving it to OneDrive. It was part of my testing. I went through a lot of trial and error and Google searches a couple of weeks ago figuring this out even though I know (through the early adopter program) that a PDF option is coming to Survey123. I'm a GIS specialist who dabbles in the development world. I'm no Power Automate or webhook expert. There is probably a different way to do this but I wanted to share this with the community. It might inspire others to find a different solution or be inspired to try something new. p.s. I finally finished writing up this post and I've already found a possible alternative to using HTML!
... View more
01-13-2020
11:27 AM
|
9
|
13
|
11118
|
|
POST
|
Looking back at my original form questions I wondered if the field, facility_type, was throwing an error because it is a hidden question type. When I changed the facility_type_temp to an ESRI Type of esriFieldTypeString, republished and uploaded the test template then it passed the syntax check. Even though the hidden question type had an ESRI Type of esriFieldTypeString it appears that the template requires the question type to be a select_mutliple question type. Now the question is how to make the pattern of "other" work... By the way ${facility_type_temp | countSelected} still failed the syntax check Error: Failed to parse ${facility_type_temp | countSelected}.
... View more
12-19-2019
07:56 AM
|
0
|
0
|
4705
|
|
POST
|
I created a small form for testing. My results show that including ${select_multiple | countSelected} never gets past the syntax check when uploading the file. I was using ${sample1 | countSelected}. I do have an open case and the tech support analyst had the same result. Does using countSelected work? Can you show me example of the expected output? I was able to see other results with the test form. I had expected that the appearance:"bullets" filter would show dots and instead it showed a numbered list. Maybe the documentation can be updated to be more clear? The select_one question (asset) had an answer of either yes or no The select_multiple question (sample1) had the following choices: red, blue, yellow Input: ${asset|selected:”yes”} Yes ${asset|selected:”no”} No Output: Yes ☐ No Input: List all favorite colors 3 ${sample1 | selected:"red"} red ${sample1 | selected:"blue"} blue ${sample1 | selected:"yellow"} yellow Output: List all favorite colors 3 red blue ☐ yellow Input: List all favorite colors 4 ${sample1|appearance:"bullets"} Output: List all favorite colors 4 red blue
... View more
12-19-2019
07:10 AM
|
0
|
0
|
4705
|
|
POST
|
I shared the wrong form template with you. I've now shared all of the relevant items to the group I invited to you too. I included the original template generated from Manage templates and a modified template with ${facility_type|appearance:"bullets"} in it, that fails the syntax check when I try to upload it. It is true that I have note fields in the survey because the person who does the inspections is always the same. I can also open an formal ESRI incident request if that would help.
... View more
12-10-2019
07:50 AM
|
0
|
3
|
4705
|
|
POST
|
I shared the form through a group called ESRI Incident that I invited you to join.
... View more
12-09-2019
11:33 AM
|
0
|
0
|
4705
|
|
POST
|
Is it possible to rename a feature report using a value from the survey itself? Site address is one of the values that is collected through a survey. I would like the survey saved with that name before it gets uploaded to OneDrive. OneDrive doesn't appear to have a rename action. I found a post from March 2019 with a screenshot showing the configuration of a survey in Integromat https://community.esri.com/message/841866-survey123-integromat-create-feature-report. It shows parameters for where and outputFilename. I don't see those parameters in my configuration. I only see Connection, Survey, Report Template and Feature ObjectID. Are the additional parameters accessible? Is there a different way to rename a file?
... View more
12-09-2019
08:11 AM
|
0
|
4
|
1846
|
|
POST
|
Here you go. I'm not changing anything else on the document I download except for that one line.
... View more
12-07-2019
05:17 AM
|
0
|
6
|
4705
|
|
POST
|
I'm having problems getting past the syntax test when uploading a feature report template. I created a new template from S123. I'm changing one select_multiple question to try out the examples in my own survey from the help guide. ${facility_type} is the original and it works. The output is full,carry_out Trying ${facility_type | selected:"full"} Full - (Why do I need to include the word Full outside of the curly brackets? Is it a label?) Error: Failed to parse ${facility_type|selected:”full”}. Filter selected:”full” is not supported." or ${facility_type|appearance:"bullets"} Error: Failed to parse ${facility_type|appearance:"bullets"}. Filter appearance:"bullets" is not supported."
... View more
12-06-2019
01:38 PM
|
0
|
8
|
4924
|
|
POST
|
I have an existing published feature service. In the item details I can see a Created date and an Updated date. When does the updated date change? When the service gets re-published (overwritten)? Or, when something else about that service changes? It did not change when I edited the summary on the item details page. Is there another way to find out when a service was republished?
... View more
12-05-2019
01:05 PM
|
0
|
1
|
1453
|
|
POST
|
The completed list from the worker's view is difficult to use. 1) there is a vertical scroll bar on the right side that is so thin I have never been able to grab and use it myself. 2) I noticed that if the list is long and an item is found way down the list via the search box it is not easy to get back to the top. I'm basically trying to get back to top to get to the search box again. After I do the first search the search box disappears. I found that I had to sort on a different choice and that showed the top of the list again and the search box.
... View more
10-10-2019
08:21 AM
|
0
|
2
|
667
|
|
POST
|
On the worker map on a tablet there are two search boxes. One is in the upper right hand corner of the map. I will call that the map search box. The second is above the worker list. I'll call that the list search box. When searching with the map search box the app disappears. When I use the list search box the app performs as expected. I really was not aware of the list search box until one of our workers stopped by and showed me how the app dies when he uses the map search box. That is when I discovered the other search box. Is the issue with the map search box known?
... View more
10-10-2019
08:13 AM
|
0
|
0
|
324
|
|
POST
|
I set a filter on the worker map to only show assignedDate past July 1, 2019 on the worker's tablet. Mainly because the worker doesn't need to see all of the past completed assignments (currently 2,192). The worker map on the tablet is not honoring that filter. It is still showing all of them. On the desktop Workforce page the worker map is honoring the filter setting. I tried refreshing the app, closing the app, signing out of the app...still shows all.
... View more
10-10-2019
08:07 AM
|
0
|
0
|
519
|
|
POST
|
Hi Ismael, I was able to recreate the form item using your steps. My survey dashboard is back. Thanks!!! *Let's say that I was able to get the device in the field with the original form on it. Would I need to use iExplorer to pull that form off the ipad?
... View more
10-07-2019
06:10 PM
|
1
|
1
|
3009
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-05-2025 11:56 AM | |
| 1 | 11-27-2024 11:10 AM | |
| 22 | 08-12-2024 11:06 AM | |
| 1 | 02-01-2019 08:27 AM | |
| 2 | 04-23-2024 08:44 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-06-2025
12:09 PM
|