cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
288088
Post Partisan
Post Partisan

Make a person field clickable in powerapps gallery

Hello!

 

I got this sharepoint list where I have a person/group column where I can choose multiple people inside. And I got this code in powerapps to display them in a good way:

Mid(
    Concat(
        ThisItem.Person;
        Char(10) & DisplayName
    );
    2;
    Len(
        Concat(
            ThisItem.Person;
            Char(10) & DisplayName
        )
    )
)

Is there anyway to make those names that shows up in the gallery clickable to see more information about them? Like phonenumber etc.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @288088 ,

Do you want to display more details if you click the display name of person field?

Firstly, I suggest you not use label to display displaynames in each row. Because there are multiple displaynames in one row, if you display them in a same label, you could not distinguish selected displayname.

I suggest you use listbox to display displaynames in each row.

What's more, you could only display display,  email, jobtitle, photo of a person field if you only use sharepoint list as connector. If you want to see more information about them, like phonenumber etc, you need to use Office365 Users connector.

 

I've made a similar test for your reference:
my list name is survey, my multiple person field named peo.

1)connect your app with sharepoint list and Office365 Users

2)insert a gallery to display this list, set its Items:

survey

insert a listbox(named listbox1) inside the gallery, set its Items:

ThisItem.peo

On your side , you should use:

ThisItem.Person

set the listbox's Default to blank

528.PNG

3)insert a label inside the gallery to display the further information of selected user

set the label's Text:

If(!IsBlank(ListBox1.Selected.DisplayName),Office365Users.UserProfileV2(ListBox1.Selected.Email).mobilePhone)

Then the label will display each row's selected user's phone number.

Actually, Office365Users.UserProfileV2 could get more information, not only mobilePhone.

This function could get these:

Name Path Type Description
About Me
aboutMe string

About Me

Account enabled?
accountEnabled boolean

true if the account is enabled; otherwise, false. This property is required when a user is created.

Birthday
birthday date-time

Birthday

Business Phones
businessPhones array of string

Business Phones

City
city string

The city in which the user is located.

Company name
companyName string

The name of the company in which the user works.

Country
country string

The country/region in which the user is located; for example, "US" or "UK".

Department
department string

The name of the department in which the user works.

Display Name
displayName string

Display Name

Given Name
givenName string

Given Name

Hire Date
hireDate date-time

Hire Date

Id
id string

Id

Interests
interests array of string

Interests

Job Title
jobTitle string

Job Title

Mail
mail string

Mail

Nickname
mailNickname string

The mail alias for the user. This property must be specified when a user is created.

Mobile Phone
mobilePhone string

Mobile Phone

My Site
mySite string

My Site

Office Location
officeLocation string

Office Location

Past Projects
pastProjects array of string

Past Projects

Postal code
postalCode string

The postal code for the user's postal address. The postal code is specific to the user's country/region. In the United States of America, this attribute contains the ZIP code.

Preferred Language
preferredLanguage string

Preferred Language

Preferred Name
preferredName string

Preferred Name

Responsibilities
responsibilities array of string

Responsibilities

Schools
schools array of string

Schools

Skills
skills array of string

Skills

State
state string

State

Street Address
streetAddress string

Street Address

Surname
surname string

Surname

User Principal Name
userPrincipalName string

User Principal Name

User Type
userType string

User Type

You just need to change the last fieldname in my formula.

For example, if you want to get selected user's Hire Date, you could set the label's Text:

If(!IsBlank(ListBox1.Selected.DisplayName),Office365Users.UserProfileV2(ListBox1.Selected.Email).hireDate)

 5281.PNG

 Please notice that: this function returns data from azure profile. If that user set no data in azure profile, you will get nothing by using this connector.

 

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/connectors/office365users/#get-user-profile-(v2)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
mdevaney
Super User
Super User

@288088 
You can try to make an 'accordion' style gallery as shown by @Mr-Dang-MSFT to allow for detail expand.

 

Link to video:

https://www.youtube.com/watch?v=IjiZDVHAnZo

 

---
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."

v-yutliu-msft
Community Support
Community Support

Hi @288088 ,

Do you want to display more details if you click the display name of person field?

Firstly, I suggest you not use label to display displaynames in each row. Because there are multiple displaynames in one row, if you display them in a same label, you could not distinguish selected displayname.

I suggest you use listbox to display displaynames in each row.

What's more, you could only display display,  email, jobtitle, photo of a person field if you only use sharepoint list as connector. If you want to see more information about them, like phonenumber etc, you need to use Office365 Users connector.

 

I've made a similar test for your reference:
my list name is survey, my multiple person field named peo.

1)connect your app with sharepoint list and Office365 Users

2)insert a gallery to display this list, set its Items:

survey

insert a listbox(named listbox1) inside the gallery, set its Items:

ThisItem.peo

On your side , you should use:

ThisItem.Person

set the listbox's Default to blank

528.PNG

3)insert a label inside the gallery to display the further information of selected user

set the label's Text:

If(!IsBlank(ListBox1.Selected.DisplayName),Office365Users.UserProfileV2(ListBox1.Selected.Email).mobilePhone)

Then the label will display each row's selected user's phone number.

Actually, Office365Users.UserProfileV2 could get more information, not only mobilePhone.

This function could get these:

Name Path Type Description
About Me
aboutMe string

About Me

Account enabled?
accountEnabled boolean

true if the account is enabled; otherwise, false. This property is required when a user is created.

Birthday
birthday date-time

Birthday

Business Phones
businessPhones array of string

Business Phones

City
city string

The city in which the user is located.

Company name
companyName string

The name of the company in which the user works.

Country
country string

The country/region in which the user is located; for example, "US" or "UK".

Department
department string

The name of the department in which the user works.

Display Name
displayName string

Display Name

Given Name
givenName string

Given Name

Hire Date
hireDate date-time

Hire Date

Id
id string

Id

Interests
interests array of string

Interests

Job Title
jobTitle string

Job Title

Mail
mail string

Mail

Nickname
mailNickname string

The mail alias for the user. This property must be specified when a user is created.

Mobile Phone
mobilePhone string

Mobile Phone

My Site
mySite string

My Site

Office Location
officeLocation string

Office Location

Past Projects
pastProjects array of string

Past Projects

Postal code
postalCode string

The postal code for the user's postal address. The postal code is specific to the user's country/region. In the United States of America, this attribute contains the ZIP code.

Preferred Language
preferredLanguage string

Preferred Language

Preferred Name
preferredName string

Preferred Name

Responsibilities
responsibilities array of string

Responsibilities

Schools
schools array of string

Schools

Skills
skills array of string

Skills

State
state string

State

Street Address
streetAddress string

Street Address

Surname
surname string

Surname

User Principal Name
userPrincipalName string

User Principal Name

User Type
userType string

User Type

You just need to change the last fieldname in my formula.

For example, if you want to get selected user's Hire Date, you could set the label's Text:

If(!IsBlank(ListBox1.Selected.DisplayName),Office365Users.UserProfileV2(ListBox1.Selected.Email).hireDate)

 5281.PNG

 Please notice that: this function returns data from azure profile. If that user set no data in azure profile, you will get nothing by using this connector.

 

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/connectors/office365users/#get-user-profile-(v2)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi @288088 ,

I notice that : in your region, it seems that you use ";" instead of ",".

If so ,please change all my "," in my formula to ";".

That's just region's difference.😃

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft Thanks! This works great, just one thing. Is there anyway to make the listbox autoheight depending how many people there is in it?

Hi @288088 ,

You just need to set the listbox's Height related to CountRows function.

For example , set it to:

CountRows(ThisItem.peo)*50

 

On your side, it should be:

CountRows(ThisItem.Person)*50

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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 (2,935)