I am having trouble with routing rules and attempting to solve this issue using Power Automate to move emails coming into the inbox of a shared mailbox. We currently use Inbox rules on the shared folder but we keep running into issues of codes being used further down in the email chain and triggering the move rule. There is no way to correctly order these and I do not know of a way to search just a section of the body of the email for a specific trigger so I am attempting to use Power Automate for this.
I currently have a list of 40 possible routes an email could go based on trigger codes in the first body of the email. I have the flow working for a single condition for searching for one code. But the conditions fail if I branch to multiple conditions or put a second condition under the "no" of the first condition. I am splitting the email body on the company phone number in the signature line to get the first message body without any reply data to omit previous routing codes and trying to route the new email soley based on the body of the most recent email.
What is the best approach for handling this?
Flow currently:
Trigger: When email arrives in inbox
Convert email body to HTML
compose - uriComponent(body('Html_to_text'))
compose 2 - split(outputs('Compose_2'),'800-555-6571')
compose 3 - decodeUriComponent(first(outputs('Compose_-_Split_After_Phone_Number')))
initialize - type: string, value: output of compose 3
condition - searching the initialized string for codes and move to correct folder
What i am wanting to do is
- If first split output contains "ooo", move to "Orders" folder
- If first split output contains "qqq", move to "Quotes" folder
- If first split output contains "rga", move to "Returns" folder
The below works for a single condition only.
