cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
faustocapellanj
Memorable Member
Memorable Member

The property expects Record values, but this rule produces incompatible Text values

Hello everyone,

 

I'm working on a PowerApps form connected to a SharePoint list. This list contains several different fields; single line of text, date and time, and person/group. One of the requirements is to retrieve the current user's manager and automatically populate the Person field in PowerApps. As everybody else has mentioned, a SharePoint Person/Group field becomes a dropdown in PowerApps and it's difficult to set a default value to it. For example, I can retrieve the current user's manager and pass its value to a label or text field, but can't pass it to this dropdown. Whenever I try to set the value using the formula: 
Office365Users.Manager(Office365Users.MyProfile().Mail).DisplayName, I get the message "The property expects Record values, but this rule produces incompatible Text values".

 

Has anybody had any luck achieving this? Thanks in advanced.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi @faustocapellanj

 

I had setup SharePoint Person/Group field which automatically defaults to user manager.

 

To achieve this you have to add Office 365 Users connector.

 

In the OnVisible property of the Screen where the Form is located I have the following function:

 

UpdateContext(
  {
    Manager:Office365Users.Manager(First(UserProfileCollection).Id)
  }
)

Basically this LooksUp the manager of the person. 

 

 

UserProgileCollection is a collection which is setup on the start of the app this way:

Collect(UserProfileCollection,Office365Users.MyProfile()))

Basically, it just collects all info available from the Office 365 Users connector on the User.

 

Then in your form for the Person/Group card add the following formula for the Default property:

    {
        '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:Concatenate("i:0#.f|membership|",Manager.Mail),
        Department:Manager.Department,
        DisplayName:Manager.DisplayName,
        Email:Manager.Mail,
        JobTitle:Manager.JobTitle,
        Picture:""
    }

 

 

You can do all the calling in the Default function but it will slow down your app, as well as, you can do it for any user in your organization if you know their email.

View solution in original post

4 REPLIES 4
v-monli-msft
Community Support
Community Support

Hi @faustocapellanj,

 

Sorry but the Office365Users.MyProfile().Mail and Office365Users.UserProfile( ).DisplayName are both for Office 365 Users connector, not for SharePoint Person/Group column. Office 365 users connector gets user accounts from the Azure AD not SharePoint. This is why the formula won't work as expected. Please try to add the office 365 data source in this app and then test.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @faustocapellanj

 

I had setup SharePoint Person/Group field which automatically defaults to user manager.

 

To achieve this you have to add Office 365 Users connector.

 

In the OnVisible property of the Screen where the Form is located I have the following function:

 

UpdateContext(
  {
    Manager:Office365Users.Manager(First(UserProfileCollection).Id)
  }
)

Basically this LooksUp the manager of the person. 

 

 

UserProgileCollection is a collection which is setup on the start of the app this way:

Collect(UserProfileCollection,Office365Users.MyProfile()))

Basically, it just collects all info available from the Office 365 Users connector on the User.

 

Then in your form for the Person/Group card add the following formula for the Default property:

    {
        '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:Concatenate("i:0#.f|membership|",Manager.Mail),
        Department:Manager.Department,
        DisplayName:Manager.DisplayName,
        Email:Manager.Mail,
        JobTitle:Manager.JobTitle,
        Picture:""
    }

 

 

You can do all the calling in the Default function but it will slow down your app, as well as, you can do it for any user in your organization if you know their email.

Hi @v-monli-msft,

 

While I thank you for taking the time to reply to my issue, I am aware that I need to use the Office 365 Users connector and I am currently using it in my application. My issue is not retrieving information about the current user, but with setting a default value to a Person field dropdown in PowerApps. Another user, @Anonymous, suggested an approach to achieving what I'm trying to do, but I'm not able to set such default value.

 

Thanks.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Hi @Anonymous,

 

I had posted something before about your suggestions not working, but I just checked my app and the field is populated with the current user manager. Thank you so much.

 

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

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 (4,792)