cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gazbeer
Helper III
Helper III

Patching person column from collection

Hi All,

 

After some formula advice please. 

 

I have a some dropdowns 

 

'IssuedTo' 'ItemofPPE' and a couple more. Issued to is referenced from Office365,SearchUser() and Item of PPE is referenced from a choice box in a sp list called 'PPEIssue' 

 

The user completes the drop downs then saves them to a Collection... 'NewIssue' 

 

All this works fine. But I am having trouble with the formula that patches the patch that writes that to sp. 

 

I'm not sure what I'm meant to put in this bit. That references each collection item.

 

ForAll(Patch(PPEIssue, Defaults(PPEIssue), {IssuedTo:

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
Claims:"";
Department:"";
DisplayName:"";
Email:"";
JobTitle:"";
Picture:""

 

Any help is appreciated. 

 

Gary

8 REPLIES 8
RandyHayes
Super User
Super User

@Gazbeer 

So in your formula, you are not specifying anything for your ForAll to iterate over.  I would assume this would be your collection.

Also, you are not assigning any values to your people columns.  If you want to set them you need to supply some values.

Finally, depending on how you are defining the Items properties of your dropdowns/comboboxes where you are getting the people value selected, you might not need any of the record definition you are providing.

 

To assign a People column, you need to at least provide the columns you have.  You no longer need to specify the odata.type on the record.

 

So, assuming you have a collection of records you wish to submit to the SharePoint list as new records in your collection, then the following is what you are looking for:

Collect(PPEIssue, 
    ForAll(yourCollection
        {IssuedTo:
            {Claims:"i:0#.f|membership|" & Lower(personEmailColumnFromYourCollection)), 
             Department: "", 
             DisplayName: personEmailColumnFromYourCollection, 
             Email: personEmailColumnFromYourCollection, 
             JobTitle: ".", 
             Picture: "."
         }
    )
)

 

If the dropdown/combobox items property is based on Choices(yourPeopleColumn) and you are storing the selected value in your collection, then none of the above (except the Collect and ForAll) are needed.

 

Also, if your collection has the same column names as your datasource, then there is no need to ForAll each record, just Collect(yourDataSource, yourCollection) and all the rest is done for you.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi. 

 

Thank you for your fast reply. , yes sorry, I missed the collection off the formula on here.

 

The combobox for the person search item is Office365,SearchUser() .

 

How do I reference their email address from a gallery that only has a name saved is my biggest confusion. 

 

I tried choices(people column) but it didn't populate any data? 

 

I will have a play with your formula in the morning. Appreciate your help

 

Gary

RandyHayes
Super User
Super User

@Gazbeer 

Choices on People columns in a combobox will not provide lists of names in a dropdown.  The primary purpose is to provide values for the Search function in the Combobox (you need search on in order to search and find anything).

The advantage though is that the person selected is then already a SharePoint person record. No conversion is needed.

If you base on Office365 users, then it will have an Office365 User record and thus need to be changed to a SharePoint record.  This can be done in your formula you have, or it can also be done in the Items property of the Combobox...which then makes it easier for the other formula and updating that you have.

 

Now, you also mention getting information from the Gallery...can you elaborate more on what you are trying to achieve?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Sorry I'm a bit new to this. 

 

Combobox is now working as you described. Thanks. I tried the easy was you described but got a lot of errors. My collection column names are the same as my sp but I think I my need to code it the long way because one is a date column. And the rest are choice columns. See below. (Ignore my mess haha. Lots of different forumalas 🤣)

20210328_203751.jpg

RandyHayes
Super User
Super User

@Gazbeer 

Actually, what you show is easily resolved.  You have a Watch column where you are not providing the correct datatype in the collection and you have a DateOfIssue which is not the "real" name of the column in your SharePoint list.

So, tell me more about those columns and how you are assigning them.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Good Morning, that sounds good!

 

The combo boxes all use Choices, except date which has nothing.

 

Button to collect



Collect(
colNewIssue,
{
IssuedTo: ComboBox1.Selected.DisplayName,
Watch: ComboNewIssueWatch.Selected.Value,
DateofIssue: DatePickerNewIssue.SelectedDate,
ItemofPPE: ComboNewIssueItem.Selected.Value,
KitNumber: ComboNewIssueKitNo.Selected.Value,
ItemReference: NewIssue_Ref.Text
}
)​

 

Sp List

powerss.png

Thank you

Gary

RandyHayes
Super User
Super User

@Gazbeer 

So, then how are you setting the Watch column in your collection?  It needs to be a record as the list settings indicate it is a Choice Column.

As for DateofIssue column...it is most likely not its real name.  In your list settings, click on the DateofIssue column name and then, once you are at the column settings page, look at the end of the URL in the browser. It will have a Field=xxxxx  where xxxxx is going to be the "real" name.  See what that is.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi, sorry for my late reply, i have been on leave this week, so the URL for DateofIssue says,  Field=Date

The Watch column has a dropdown that has an item property of Choices('PPE Issue Item'.Watch)

 

What do you mean it needs to be a record?

 

Many Thanks

 

Gary

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,576)