cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BaseCamp
Helper I
Helper I

I cant save a record (person) into a collection

Hello ,

 

I want to update a collection with a record (people field) which I select from a combobox in a gallery.

When I save the item of the gallery the selected persons record should be saved in the collection.

I tried with following:

Patch(MyCollection;Thisitem;{
ColUserRecord:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
Claims:"i:0#.f|membership|John.Doe@google.com";
Department:"";
DisplayName:"John Doe";
Email:"John.Doe@google.com";
JobTitle:"";
Picture:""
};
1 ACCEPTED SOLUTION

Accepted Solutions

I solved it...

 

When I add an empty row to the collection I didn't fill an empty personrecord to the collection:

Collect(CollectDesignHours;{
ColDate:Today();
ColHours:Blank();
ColUserRecord:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
Claims:"";
Department:"";
DisplayName:"";
Email:"";
JobTitle:"";
Picture:""
}})
Because I didn't add the empty record to the collection I was not possible to patch the data into the record. (also no error showed up).

 

View solution in original post

9 REPLIES 9
mdevaney
Super User
Super User

@BaseCamp 

I see two missing parenthesis at the end of your code.  Could this be the issue?

 

Patch(MyCollection;Thisitem;{
ColUserRecord:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
Claims:"i:0#.f|membership|John.Doe@google.com";
Department:"";
DisplayName:"John Doe";
Email:"John.Doe@google.com";
JobTitle:"";
Picture:""
}});


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

No, I just forgot to write them down in the code.

 

@BaseCamp 
What type control are you putting this code in?  Also, what property? 

 

Please also share a screenshot of your app.

I'm working with a combobox in a gallery:

 

Items:  Distinct(UsersList;AllowedUserRecord.DisplayName)
DefaultselectedItems:  
{Result: ThisItem.ColUserRecord.DisplayName} - which seems only to work in preview-mode 

I have a savebutton in the gallery:

On Select: 

Patch(CollectHours;ThisItem;{
ColDate:Date.SelectedDate;
ColUserRecord:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
Claims:"i:0#.f|membership|John.Doe@google.com";
Department:"";
DisplayName:"John Doe";
Email:"John.Doe@google.com";
JobTitle:"";
Picture:""
}})

 

@BaseCamp 
I am wondering if the targeting method you used in the 2nd argument of PATCH is not finding the collection row we want to write to.  Can you please do a test for me?  Use this code in OnSelect to try and only patch the date.  Let me know if the date is successfully written to the collection.

 

Patch(CollectHours; ThisItem; {ColDate: Date(2020,04,30)})

 

For your CollectHours collection, can you please let me know if there is a unique identifier in the collection such as ID number?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

Hello 

I tried your suggestion, the date shows up in the collection correctly.

I also tried to save only the record to the collection but that didn't work...

 

 

I solved it...

 

When I add an empty row to the collection I didn't fill an empty personrecord to the collection:

Collect(CollectDesignHours;{
ColDate:Today();
ColHours:Blank();
ColUserRecord:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
Claims:"";
Department:"";
DisplayName:"";
Email:"";
JobTitle:"";
Picture:""
}})
Because I didn't add the empty record to the collection I was not possible to patch the data into the record. (also no error showed up).

 

View solution in original post

@BaseCamp 

Makes sense.  I assumed you had already done this.  I'm glad you fixed it.

 

Best of luck in building your app!

I never thought of that because the recordcolumn showed up in the collection. Only the recordsymbol was missing in the rows. I thought after patching it would show up... I hope MS creates a warning for that.

That really took me days to figure out... But I'm ok now 🙂

 

Thanks for your help MDevaney! 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,698)