cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

Patch does not return a record with an ID when calling against SharePoint List Data Source

Does anyone know how to force Patch to return an ID when I'm using a SharePoint list as a Data Source?

 

This is a simple example that I'm using. It saves a SharePoint list item with no issues. But Patch does not return an ID for the newly created list item. I was wondering if it's a bug or I'm doing something wrong.

 

ClearCollect(NewProjectRecordCollection, Patch(Projects, {
    Title: ProjectMetadata.Name,
    ClarityID: ProjectMetadata.ClarityID,
    PlannedDeliveryDate: ProjectMetadata.DeliveryDate,
    Description: ProjectMetadata.Description,
    AccountablePMO: ProjectMetadata.AccountablePMO,
    ClassCode:ClassCode
}));

 

No iD returned.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

I just did a quick test with Patch and creating a new item in SharePoint and it return the ID.

 

My code example:

 

ClearCollect(colPatch, Patch(PowerAppsDemo, Defaults(PowerAppsDemo),{Title:"Test Patch"}))

 

My Results:

PatchTest.png

 

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Highlighted
Super User II
Super User II

I just did a quick test with Patch and creating a new item in SharePoint and it return the ID.

 

My code example:

 

ClearCollect(colPatch, Patch(PowerAppsDemo, Defaults(PowerAppsDemo),{Title:"Test Patch"}))

 

My Results:

PatchTest.png

 

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Highlighted

Thank you,@Jeff_Thorpe,

 

I'm not sure if it's a bug or a feature, but Defaults(<Datasource>) makes a big difference.

 

It seems that Patch does return an ID every time, but PowerApps will throw errors design time if I try to access the returned ID. That is unless I use ClearCollect with Defaults()

 

 

This does not generate correct Collection (see screenshot 2):

ClearCollect(PathedItemCollection, Patch(Stakeholders, {Title:"test"}))

But this does (see screenshot 1):

ClearCollect(PathedItemCollection, Defaults(Stakeholders), Patch(Stakeholders, {Title:"test"}))

ID 2.png

 

If I don't use Defaults - the results of the Patch function will not be properly "mapped" to my collection.

 

ID 1.png

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,727)