Skip to main content

Notifications

Community site session details

Community site session details

Session Id : qQFgJ/0PHcMT9GDuq3jv3u
Power Automate - Building Flows
Answered

Creating a condition To Update or Create Item

Like (0) ShareShare
ReportReport
Posted on 4 Dec 2020 20:45:54 by 17

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.

 

image.png

 

  • tom_riha Profile Picture
    10,085 Most Valuable Professional on 08 Dec 2020 at 19:13:04
    Re: Creating a condition To Update or Create Item

    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.image.png

  • fchopo Profile Picture
    7,968 Super User 2025 Season 1 on 08 Dec 2020 at 19:00:38
    Re: Creating a condition To Update or Create Item

    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

  • amallette72 Profile Picture
    17 on 07 Dec 2020 at 21:38:19
    Re: Creating a condition To Update or Create Item

    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.

    amallette72_0-1607376658839.png

    amallette72_1-1607376892238.pngamallette72_2-1607376952132.png

     

    amallette72_3-1607377023895.png

     

  • amallette72 Profile Picture
    17 on 07 Dec 2020 at 17:22:31
    Re: Creating a condition To Update or Create Item

    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

    amallette72_0-1607361622731.png

    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

  • Verified answer
    fchopo Profile Picture
    7,968 Super User 2025 Season 1 on 05 Dec 2020 at 20:01:33
    Re: Creating a condition To Update or Create Item

    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:

    items.png

     

     

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started