Announcements
Hi,
I want to do two patches from a PowerApps canvas app to SharePoint and I want to get the ID(generated by the SharePoint list while saving a new record) of the record saved using the first patch and pass it as a value to the second patch.
eg,
First_patch=Patch(
DataSource1,
{col1:val1}
);
Patch(
DataSource2,
{col1:First_Patch.ID}
How can this be done? Any ideas? Thanks in advance.
@Drrickryp @mdevaney @WarrenBelz
@michaeldanieal
Hi , you can do it one of 2 ways.
Anytime you patch you can get the data back (in the form of the New record by doing either)
ClearCollect(PatchResult, Patch(Table, Defaults(Table) { stuff here: })); Then to get the ID First(PatchResult).ID or ColumnName Or you can do a Set(PatchResult, Patch(Table, Defaults(Table) { stuff here: })); And then do PatchResult.Id / ColumnName Now I am not 100% if the issue is truly fully resolved but for a very long time doing Set, didn't always populate correctly and ClearCollect does. Or you can do a With Statement as well and avoid variables, but the top 2 there work.
If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help othersCheersThank YouMichael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsofthttps://gernaeysoftware.comLinkedIn: https://www.linkedin.com/in/michaelgernaey
Set(varFirstPatchID, Patch(sp_list, Defaults(sp_list),{column:"some_value"}).ID)
varPatchID will store the id of the first patch
Seb
Thank you, your solution worked exactly as you described.
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 329 Most Valuable Professional
11manish 209 Super User 2026 Season 2
Mohsin Ali 179