I built a flow to abstract a GUID from email body when new emails come in. The email body could contain:
I have built the following expression to extract the GUID
if(greater(indexof(body('Html_to_text'), '***KeyEnd'), 1),
substring(body('Html_to_text'), Add(indexof(body('Html_to_text'), 'KeyStart***'), 11), 36),
substring(body('Html_to_text'), 0, 36))
For the second case, it works. For the first case, it always returns "index out of range" in the substring. Does anyone know why?
Could you please share a screenshot of your flow's configuration?
The issue is confirmed on my side, I think this issue is related to the second parameter within your if() function. But when I add the following formula within a separated "Compose" action, the "Compose" action works well when the email body contains 3932FB4C-0DF5-11E8-A5C3-7804C4623542:
I afraid that this is issue is related to the if() function. In addition, you could consider take a try with the the following workaround as an alternative way:
@greater(indexof(body('Html_to_text'), '***KeyEnd'), 1)
The flow works successfully as below:Best regards,
Thanks for your reply. I actually found out where the problem came from, the If operation will evaluate both parameter 2 and 3 no matter if the parameter 1 is true or false.
Thanks @v-xida-msft this fixed my si,milar issue, but is there somewhere I can vote to get the if statement to not require this workaround.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
Check out the community blog page where you can find valuable learning material from community and product team members!