I created an inspection form in Power Apps for site visits. The inspection form has an email field that the inspector will populate with the site business owner's address to email a PDF copy of the inspection report. I've figured out a way to extract the email address using this Shane Young video: Turn emails into data - Flow String functions, Email with options, terminate, and more. The problem is that in his video he uses character count to extract a name from a form, I tried using the same method to extract the email address from my form. So I used some of his methods but inserted some of my own since the email field in my form is dynamic, I inserted an HTML to Text action (to extract the email and turn it into a text string), followed by an Initialize variable action (for the converted email text string). However, as I suspected, it worked with the content I had in the form but once I changed the content, it didn't work because the character count changes when the content changes.
This is the rest of my Flow
I have found similar posts but it is usually regarding a static email address in Flow. I'm very close, I was able to make Shane's method work but as I stated, it didn't account for the fields before to be dynamic and change the character count.
Your help is appreciated.
Thanks!
Solved! Go to Solution.
I had to make a slight modification to my solution and have tested it with different email addresses and filling out the form and it works....thank goodness. So still a variation on Shane's email:
1. I created a Compose action, as he does to find the "Email:" string in my HTML, however, I included the Add expression with the IndexOf expression he uses to account for the characters of Email: which as you can see below is 6 characters which finds the email in the string.
Add(indexOf(triggerBody()['text'],'Email:'), 6)
Then the rest from the previous solution:
I then used his method of ending that field by using the closing html tag with the use of another Compose action using the indexOf expression.
indexOf(outputs('email'),'</p>')
Created another Compose action for drawing out the Email only, using the substring expression:
substring(outputs('email'),0,outputs('EndOfEmail'))
Then used the Html to Text action, selecting the EmailOnly output.
Created a variable with Initialize variable using the Html to Text action at the value. Then I used this variable in the To: field in the Send an email action.
Now it works!!
Nevermind. I actually figured it out using Shane's method in a roundabout way. Instead of calculating the start of the field, I calculated the end of the field where the actual email address would begin. I then used his method of ending that field by using the closing html tag with the use of another Compose action using the indexOf expression.
indexOf(outputs('email'),'</p>')
Created another Compose action for drawing out the Email only, using the substring expression:
substring(outputs('email'),0,outputs('EndOfEmail'))
Then used the Html to Text action, selecting the EmailOnly output.
Created a variable with Initialize variable using the Html to Text action at the value. Then I used this variable in the To: field in the Send an email action.
After several tests, this method does not extract just the email from the form using the number of characters. Help is appreciated!
I had to make a slight modification to my solution and have tested it with different email addresses and filling out the form and it works....thank goodness. So still a variation on Shane's email:
1. I created a Compose action, as he does to find the "Email:" string in my HTML, however, I included the Add expression with the IndexOf expression he uses to account for the characters of Email: which as you can see below is 6 characters which finds the email in the string.
Add(indexOf(triggerBody()['text'],'Email:'), 6)
Then the rest from the previous solution:
I then used his method of ending that field by using the closing html tag with the use of another Compose action using the indexOf expression.
indexOf(outputs('email'),'</p>')
Created another Compose action for drawing out the Email only, using the substring expression:
substring(outputs('email'),0,outputs('EndOfEmail'))
Then used the Html to Text action, selecting the EmailOnly output.
Created a variable with Initialize variable using the Html to Text action at the value. Then I used this variable in the To: field in the Send an email action.
Now it works!!
User | Count |
---|---|
103 | |
36 | |
29 | |
25 | |
16 |
User | Count |
---|---|
135 | |
53 | |
52 | |
36 | |
26 |