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

How to display departments related to current user.

On my app I am trying to display the current users department by default. On the app that department field is a combo box. Originally in SharePoint that field is a choice field with choices (SITE,WORKS,OFFICE), On the apps is there a way to default it to the current users department. I've already tried with using Office365Users.MyProfile().Department, but it comes out as an error. 

1 ACCEPTED SOLUTION

Accepted Solutions

@SandraAkujobi, I see the issue. You are using a text type when it expects a record.

 

Simply put it in brackets:

[Office365Users.MyProfileV2().department]

View solution in original post

7 REPLIES 7
DylanSimons
Resolver III
Resolver III

Just to make sure, your organization has Department properties on the profiles?

 

This is the correct way to get department as you stated:

Office365Users.MyProfileV2().department

 

What is the error you are getting?

@DylanSimons I've tried that in field datacard default function and the defaultselecteditems in the datacard.

You can see from the image below there under the formula box it displays the department but I'm unsure why it comes out as an error. 

Screenshot (199).png

Use:

Office365Users.UserProfile(User().Email).Department

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24 I've tried this as well in all both field datacard and combobox default function as well as the defaultselecteditems. Would the issue be because the field is a choice field. 

@SandraAkujobi, I see the issue. You are using a text type when it expects a record.

 

Simply put it in brackets:

[Office365Users.MyProfileV2().department]

@DylanSimons  Thanks so much that worked.

Naresh333
Frequent Visitor

Hi ,

 

Am trying to get the current user department name default but getting error

 

Naresh333_0-1646823499385.png

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,057)