Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Get id of created records


I need to save collection to DataSource (SharePoint Online) and then get ID's of these records from SharePoint Online.

I have tried syntax like "Collect(CreatedTable, Collect(SharePointList, LocalTable))", but it collects all records to "CreatedTable" from SharePoint List. Is there anyway to achieve this? With single record, the case is simple - I use Set(Var, Patch(SharePoinntList, Record)) and I get all details about created record. But how to handle the whole collection?

Level 8

Re: Get id of created records

Hello John,


If you are using Patch to update SharePoint then you only need to make a slight modification to your Patch command and place the results of your Patch into a new Collection. Then you may access this new Collection and extract the id.


ClearCollect(LastSharePointUpdates, Patch( your patch syntax)) );


Collection LastSharePointUpdates will have the data you seek.


Hope this helps.


Super User
Super User

Re: Get id of created records

Two approaches you may want to try.

1. Use a ForAll to write the records one at a time and pull back the details using the set statement as you described for a single record. Downside is that ForAll is less efficient than ClearCollect.

2. Make a note of the current highest ID in the SharePoint list

Set(varLastID, Last(SortByColumns(SharePointList, "ID").ID)

Then run your Collect, then Filter the SharePoint list for IDs greater than varLastID and (if multitple users will use the system at the same time) where the CreatedBy matches the current user login.

Neither method is great, but might be enough to achieve your goal.

Helpful resources


Watch Sessions On Demand!

Continue your learning in our online communities.


PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Join PowerApps User Group!!

Connect, share, and learn with your peers year-round


Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!


Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 60 members 4,442 guests
Please welcome our newest community members: