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

Populate people picker based on dropdown NOT containing names

On my app I have a dropdown with two values: Employee and Instructor.  I also have two people picker fields - one to store the name of the employee and one to store the name of the instructor.

 

Based on which option is chosen in the dropdown when the form is in new mode, I would like the appropriate people picker to be populated.

 

Right now on the Employee people picker’s DefaultSelectedItems value I have:

 

If(

    SharePointFormMode = “CreateForm”,

    If(

           drpFormStartedBy.Selected.Value = “Employee”,

            {

                 DisplayName: varUser.FullName,

                 Claims: “i:0#.f|membership|” & varUser.Email

             }

         ),

        Parent.Default

)

 

The variable varUser is set OnNew to User().

 

This does put my name into the Employee people picker but as FirstName LastName. When I normally pick a name from a people picker it comes back LastName, FirstName. 

 

Now the form DOES seem to populate my name in the list properly but the problem is that I also want to patch this value to a child list. On the OnSuccess value of my form I have:

 

Set(

     varEmployeeName,

   drpEmployeeName.Selected.DisplayName

);

and then my ForAll patch statement references that variable. And it’s returning the FirstName LastName value.... I need this to be LastName, FirstName as in our active directory.

 

I created a data connection to Office365Users but I’m not sure if that’s part of the solution or not... 

 

Thanks in advance for any guidance!

4 REPLIES 4
RandyHayes
Super User
Super User

@NickiPT 

Yes, instead of using the User().xxx information, get your information from the Office365 User connector.  It should reflect the DisplayName in the format you are looking for.

 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

I’ve been researching how to get this to work with the Office365Users connector and I still can’t figure it out. Forgive me, this is my first app! Can you possibly step me through this with some sample formulas for me?

RandyHayes
Super User
Super User

@NickiPT 

No problem.

If you have an email address, you can get the displayName from the connector with:

    Office365Users.UserProfileV2(<emailAddressHere>).displayName

 

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

I am trying to reply and it won't let me, it keeps saying there are HTML errors in my message. I just can't get this to work.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,437)