Get item using Patch and Set functions

Using Power Apps Patch to create a SharePoint list item

Power Apps Patch

The Power Apps Patch function can be used to create or update data. for example, you can use the Power Apps Patch function to create a SharePoint list item.

The basic Power Apps Patch command users to update a list item in SharePoint

This is quite easy and well documented on the Power Apps Patch function page.

Get the created item

But what do you do if you now want to get the details of the item that you just created. It would be helpful if you could collect the data created without having to query your data source.

Today I discovered that the Power Apps Patch function returns the item created. So that means that I can set a variable.

The basic Patch command but this time the Set function is used to set a variable to the created item.

This variable can then be used to get the ID of the list item.

The IS from the created item is now available with NewItem.ID

 

You could now for example use this item id to update another datasource with the ID in SharePoint without the need to query the item that was created by your Power App. 

 

3 thoughts on “Using Power Apps Patch to create a SharePoint list item

  1. Hi Pieter Veenstra,
    Based on your many experiences using Sharepoint List/ Flow,
    What would be less error-prone to create some Items from Powerapps , Patch directly or via Flow create item/ Send HTTP request? Because sometimes Patch 10 items at the same time takes very long time for user on mobile connection

    • Interesting question. I might create a post on that soon.

      First of all when you use the patch you should use it in combination with a Set so that you collect the result. This may help with error handling in Power Apps.

      Thee isn’t a straight forward answer to the question if Flow or Power Apps is better at updating data. Flows happen in the back ground unless you collect a result back. So that might be good, however when flows update the data you will find yourself refreshing data in your PowerApps more often.

      • Further to my previous comment. You might also want to look at UpdateIf. It is faster than Patch.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: