cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Beuferd
Level: Powered On

Pass Office365User info to SPO LIST

Hi, again.

 

I am having a heck of a time figuing out how to patch a Offic365User variable into a SPO field formated as Person/Group.

 

What is the SPO column looking for?

 

In my form I do a Office365Users.SearchUser().DisplayName on a Drop down box.  I get the name i'm looking for.

Then I try to patch it and all goes bad.

I've copied the DDbox.selected.value to a text box and tried to patch that, and it's also failed.  

Here is the code for my last attempt:

Patch(JobsList2,Defaults(JobsList2),{Title: Text1.Text, JobNumber: Text2.Text, Foreman: TextBox10})

 

Any help would be appreciated

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Level 10

Re: Pass Office365User info to SPO LIST

OK, I would suggest the following.  I have tested it and it works in my case.

 

  1. Create an SPO list of your foremen (actually it could be a list of any people and you could have a boolean flag for IsForeman etc., but let's keep it simple for now).  Let's call this list SPOpeople.  Add just one person type column, let's call it SPOperson.  Please populate the list with your foremen by placing their names/initials or whatever you like in the Title column (it will be used to choose them in the dropdown later) and obviously the same foreman should be selected for the SPOperson column value
  2. Now back in PowerApps, add SPOpeople as a data source.
  3. Let's call your foreman selection dropdown in your PowerApp DDforeman, then set DDforeman's Items property to SPOpeople and if it is not done automatically, set its Value property to Title (the Value property is only available in the Advanced tab)
  4. Set the OnSelect property for your Save button or whatever to this:
    Patch(JobsList2, Defaults(JobsList2), {Title: Text1.Text, JobNumber: Text2.Text, Foreman: DDforeman.Selected.SPOperson})

 

This should work, please let me know how you get on or if you have any questions

 

View solution in original post

12 REPLIES 12
Meneghino
Level 10

Re: Pass Office365User info to SPO LIST

Hi @Beuferd

From what is written here I think you need to make sure first of all that:

1) You are using SP Online

2) For Person or Group columns, the No option under Allow multiple selections must be selected. (And I would also set it as people only, not groups if that works for you)

 

If you are on SP online and have done 2, and you still cannot get it to work, please reply and I will experiment to try to find how we can make it work.  In any case please let me know how you get on.

Beuferd
Level: Powered On

Re: Pass Office365User info to SPO LIST

@Meneghino-

 

Thanks for the reply.

Yes, I've absolutly made sure that mulitple entry is tagged at NO.

 

Meneghino
Level 10

Re: Pass Office365User info to SPO LIST

OK, this post explains what is going on, please see @rgruian's clear reply:

https://powerusers.microsoft.com/t5/PowerApps-Forum/SharePoint-List-Update-Person-Field/m-p/6980/hig...

 

Basically SP requires a record to be patched, but the fields of that record are not the ones that Office365Users provides.

 

I have managed to sucessfully patch a user to an SPO list in a quick test just now, but it required loading the user list with the correct fields in a collection and then picking the right user from that collection.  This is easier than it sounds if you have a finite list of less than 500 people.  Given that you know your foremen, and unless you run a major construction business, then this is probably your case.

 

If you are still interested then I can guide you to a solution by continuing this conversation.  Please let me know.

Beuferd
Level: Powered On

Re: Pass Office365User info to SPO LIST

I am quite interested!

 

Please.  I'm sure I could spend another couple of hours figuring out the solution on my own, but if you feed it to me, I would be one happy guy!

 

Yes, less than 500 people for awhile.

Meneghino
Level 10

Re: Pass Office365User info to SPO LIST

OK, I would suggest the following.  I have tested it and it works in my case.

 

  1. Create an SPO list of your foremen (actually it could be a list of any people and you could have a boolean flag for IsForeman etc., but let's keep it simple for now).  Let's call this list SPOpeople.  Add just one person type column, let's call it SPOperson.  Please populate the list with your foremen by placing their names/initials or whatever you like in the Title column (it will be used to choose them in the dropdown later) and obviously the same foreman should be selected for the SPOperson column value
  2. Now back in PowerApps, add SPOpeople as a data source.
  3. Let's call your foreman selection dropdown in your PowerApp DDforeman, then set DDforeman's Items property to SPOpeople and if it is not done automatically, set its Value property to Title (the Value property is only available in the Advanced tab)
  4. Set the OnSelect property for your Save button or whatever to this:
    Patch(JobsList2, Defaults(JobsList2), {Title: Text1.Text, JobNumber: Text2.Text, Foreman: DDforeman.Selected.SPOperson})

 

This should work, please let me know how you get on or if you have any questions

 

View solution in original post

Beuferd
Level: Powered On

Re: Pass Office365User info to SPO LIST

So, it worked like a charm.

I dont' have many Foreman, but I have other work to do and don't want to maintain this list.

Any idea how to update the SPOpeople list automatically in Sharepoint?

Do you think I can pay my Admin so they can make it happen?

it would be great if I added or removed someone from the "Foreman" group the list would update? 

Do you have any idea?

I'm thankfull for your help today.

!!

Meneghino
Level 10

Re: Pass Office365User info to SPO LIST

Hi @Beuferd, glad it has worked.

I think we can actually get away with not using an SPOpeople list now that we know how patching people to SPO works.

How do you obtain your list of foremen from Office365User in your PowerApp? (I understand that you populate a dropdown with a list of foremen)

What I am thinking is that we can recreate the SPO person record with all its fields from the information from Office365.

We just need to transform it and add the missing data.  The odata.type field and some other fields do not seem to change from user to user.

Please let me know and we can progress.

Beuferd
Level: Powered On

Re: Pass Office365User info to SPO LIST

 

I don't know if I need to do this yet.

I don't want to take up your time writing somehting that might not be utilized.

If I do see that I really need it, I will post back to this thread.

again, thanks for your help.

 

 

Meneghino
Level 10

Re: Pass Office365User info to SPO LIST

No worries. I do this in my spare time because I always learn something by solving real problems, and I get to help someone else on top.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,811)