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

CDS: Updating a lookup field (User) with data from Office365Users

All,

 

I have a custom entity in CDS named CheckListItem with a field named AssignedTo. This is a lookup field to User entity, also in CDS.

 

I my app, I have a gallery named galCheckListItems. The data source for this gallery is a collection based on the CheckListItem entity named colCheckListItems, created as below:

 

Items:

ClearCollect(colCheckListItems, Filter(<my filter criteria>))

 

Within this gallery, I created a People Picker control named cmbAssignTo connected to Office365Users data source. This is how I have set it up:

Items: Office365Users.SearchUser({searchTerm: cmbAssignTo.SearchText})

DisplayFields: ["DisplayName","JobTitle"]

SearchFields: ["DisplayName","JobTitle"]

SelectMultiple: False

Default:

 

I also have a button outside the gallery named btnSave.

 

Here are my requirements:

  1. The user will search for and select a user through the cmbAssignTo People Picker. This is working;
  2. The app should update the AssignedTo field in the collection with the user selected in previous step. I’m using OnChange action for that, but I could not make it work. I’m having all kinds of errors (different schema, data type compatibility issues, etc.);
  3. I want the People Picker (cmbAssignTo) to display the user (if any) stored on the colCheckListItems I tried setting its Default property to ThisItem.AssignedTo but it did not work;
  4. When user clicks the btnSave button, I want the app to save the data on the colCheckListItems collection back to CheckListItem

Any help is highly appreciated. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: CDS: Updating a lookup field (User) with data from Office365Users

Hi @ArleiSilva ,

 

What is the property type of the field AssignedTo shows? DisplayName, JobTitle, Department or what? 

 

For example, its a name list and you include all the names of AssignedTo contained in a dropdown control called Names, do this by setting the Items property of this dropdown control to:

Distinct(CheckListItem,AssignedTo)

Then you can use this expression to only show results with that displayname  :

Filter(
    Office365Users.SearchUser({ searchTerm: SearchTerm.Text }),
    DisplayName = Names.Selected.Value)

 

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.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: CDS: Updating a lookup field (User) with data from Office365Users

Hi @ArleiSilva ,

 

What is the property type of the field AssignedTo shows? DisplayName, JobTitle, Department or what? 

 

For example, its a name list and you include all the names of AssignedTo contained in a dropdown control called Names, do this by setting the Items property of this dropdown control to:

Distinct(CheckListItem,AssignedTo)

Then you can use this expression to only show results with that displayname  :

Filter(
    Office365Users.SearchUser({ searchTerm: SearchTerm.Text }),
    DisplayName = Names.Selected.Value)

 

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.

View solution in original post

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.

Users Online
Currently online: 375 members 6,527 guests
Please welcome our newest community members: