Updating an Existing Order in the Teams List App
/ / Updating an Existing Item in the Teams List App

Updating an Existing Item in the Teams List App

Chase Street Accessories & Engraving is a small business that collects orders though multiple e-commerce platforms. Over time, we discovered a need for a consolidated list of all incoming orders where we could track order status and other data. We were already using Microsoft Teams to stay connected and organized, so when the Lists app came out, it looked like the perfect solution for tracking orders. I recently posted about how to automate tracking of incoming Shopify orders. However, what happens when an order gets updated and we need to update the list item that’s tracking it? This blog entry covers the steps our Power Automate flow uses:

Determine the “index” used to identify list item to update

Let’s say we have a list item in the Orders list that was automatically generated from Shopify, but the customer forgot to enter their email address. If we update the list item, then Shopify won’t be updated, and vice versa. Therefore, we need a way for updates in Shopify to automatically update the list item. Luckily, each Shopify order has a unique “id” that we’ll use as the index to find which list item needs to be updated.

Create a Power Automate flow to capture the updated data

The Shopify settings include the option to create webhook subscriptions that work well with Microsoft Power Automate. Create a new HTTP Request instant flow and add the JSON Schema to get order information. To keep things simple, start with just a few critical order properties that you want to update. You can then add additional properties by referencing the Shopify webhook documentation.

This image has an empty alt attribute; its file name is image-6.png
Create HTTP request operation and copy the HTTP POST URL
    "type": "object",
    "properties": {
        "id": {},
        "email": {},
        "name": {}

Next, in Shopify, go to Settings/Notifications and scroll all the way down to Webhooks. Click “Create webhook” and set the Event to “Order update,” then paste the HTTP POST URL from Power Automate into the “URL” field. Save.

Shopify webhook for an updated order

Get the name of the field that holds the unique index

You’ll need to determine the name of the column you’re filtering by, which you can do by looking at the end of the URL of the column settings in SharePoint. In the image below, I’m editing the “id” column that holds the Shopify order ID, but as you can see in the URL the actual field name is id0. Hang on to this field name for the next step.

Where to find the column field name

Identify which list item needs to be updated

Next, you’ll need to select all the list items where the index matches (in this case, the order id). Ideally, since you’ve selected a unique identifier, this process will only result in one list item being returned. To do this, create a “Get items” step and select the list you want to update.

Create a “Get items” step

Expand the advanced options if you haven’t already so that you can update the “Filter Query” field. This is where you’ll enter the filter to select your list item with the matching index.

Using the field name you just collected, create a ODATA filter query, such as id0 eq @{triggerBody()?['id']} that will search for the list item that shares the same unique identifier in that column as the update data.

Add filter query to the “Get items” step

Apply change to matching list item(s)

Because “Get items” returns an array (even if it’s only an array of one item), we have to use an “Apply to each” control to apply the update. Use the “value” output from the “Get items” step, then insert an “Update item” step.

Within “Update item,” select the list you’re updating and use the existing list item values to fill in any starred (required) columns. In the columns you want to update, insert the output from previous steps as desired. Any non-starred fields that are left blank will retain their original value.

Update the list item(s) with the new data

Success! Now what…

After updating the customer’s contact information for this order, the Shopify webhook triggers the Power Automate flow to run, and the order in the list now shows the customer’s email address.

List automatically updated with Shopify data

What now? You may want to consider adding a Teams message notification to the flow so that all staff know the list item has been updated.

Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *