I'm trying to build a flow with a condition to decide if the email is a new item or update. The way the users interact with the SharePoint list is through email. I've been able to get the flow to monitor the mailbox and create the item in SP. If they reply to the email, I don't want it to create a new record; update the existing record. I thought I had it figured out, but for some reason, it won't let me use the ID number from SP when updating a record.
Hello @amallette72 ,
are you sure the condition is correct? That the 'Subject contains WorkOrder' and at the same time the only content in 'Body is Work Order'? I'd guess that the Body will contain more than just string 'Work Order'. Try to add two 'Compose' actions before the condition, put Subject in one of them and Body to the other. Then you'll see in flow run history what values they contain and you adjust the Condition.
Hello @amallette72
I'm a little bit confused on what's your problem... Please, could you describe with more detail in which cases you want to create a new item and in which ones you want to update them? Could you share some sample emails that should trigger the flow for both cases?
By the way, I've realized that in the yes branch, in the "last split" action, you've written the formula as string and not as an expression. You have more information here: Use expressions in flow actions | Power Automate Blog (microsoft.com)
Regards,
Ferran
Hello Ferran,
Below is a screen shot of where I'm at in the process. This is the flow. I get the no portion to work but no matter how I configure the yes side for an update I get " It doesn't meet the requirements" I also am attaching a screen shot of what the actual mail looks like from a subject perspective.
Hello Ferran,
I appreciate your assistance. Your solution makes sense but when I run a test it fails at the get items step. I'm sure it probably doing wrong as this is my first flow.
The first step is monitor the inbox
When a new item arrives create a new ticket / or update an existing one
I've tried to follow your example by the following
Monitor Email
Get items
I get the following error
The $filter expression "'Brief Problem Description''Test Flow 12/7/20 11:20" is not valid. Creating query failed.
clientRequestId: b982fed6-f922-4a27-b6e7-ff62c79f3ed9
serviceRequestId: b982fed6-f922-4a27-b6e7-ff62c79f3ed9
Condition
I feel like I need to have the condition right after the first step of email monitor.
I appreciate your time and effort.
Tony
Hello @amallette72
Before updating a SP item, you have to find it and with its ID, update it. Therefore you could do something like this in the "yes" branch:
1) Get those items in a SP list where BriefProblemDescription equals the subject of the email, using an OData Expression.
2) If we got 1 or more results
2) Update the item, using the first element found and its ID attribute, using the following expression:
first(body('Get_items')?['Value'])?['ID']
Hope it helps!
Ferran
WarrenBelz
146,653
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional