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

Combo Box created from SharePoint list person object fails when adding Office365Users.SearchUser to DefaultSelectedItems

I have a Form that was created from a link to a SharePoint list and the list has a person column in it that is to be populated by the combo box that is the result of the connection with the SharePoint list data source.  Everything in the form works fine when entering data in it and using the "Find Items" search renders Office 365 users as required and submits fine to the SharePoint list.  The issue comes into play when you add "Office365Users.SearchUser" script into the "DefaultSelectedItems" property for the combo box.

 

When a user is selected in the combo box, the user object is stored as a record in the Global variables:

 

Set(strUser,DataCardValue25.Selected);

 

The record is then used to repopulate the Form on a successful form submission and after a successful Back() call.  This is done by using the following script in the "DefaultSelectedItems" property of the combo box:

 

Office365Users.SearchUser({searchTerm:strUser.Email})

 

When this is added to the "DefaultSelectedItems" property, the form still submits all the information fine except for the combo box value set by this method.  Is this a bug or is there something else that needs to be done so that the value of the combo box can be realized on Form submission?

3 REPLIES 3
v-siky-msft
Level 10

Re: Combo Box created from SharePoint list person object fails when adding Office365Users.SearchUser to DefaultSelectedItems

Hi @Dodge,

Could you share the properties of combo box?

To patch person column of SharePoint, you have to patch a record which contains "Claims", "Department", "DisplayName", "Email", "JobTitle", "Picture" columns. 

 

Please put the following codes to Update property to Data card:

{
Claims:"i:0#.f|membership|" & strUser.Email,
Department:"",
DisplayName: "",
Email: "",
JobTitle:"",
Picture:""
}

Best regards,

Sik

Dual Super User
Dual Super User

Re: Combo Box created from SharePoint list person object fails when adding Office365Users.SearchUser to DefaultSelectedItems

Hey @Dodge 

 

For the DefaultSelectedItems property to work, you need to pass the value with same schema as provided in the Items property.

The schema returned by Office365Users.SearchUser({searchTerm:strUser.Email}) is different from what is supported in a person's type field.

Can you try to update the expression to:

Table({'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|"& DataCardValue25.Selected.Email,
Department:"",
DisplayName:DataCardValue25.Selected.displayName,
Email:DataCardValue25.Selected.Email,
JobTitle:".",
Picture:"."
})

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Dodge
Level: Powered On

Re: Combo Box created from SharePoint list person object fails when adding Office365Users.SearchUser to DefaultSelectedItems

I actually found a very simple solution for this issue.

 

When you set the Global variable for the dropdown from the person object selected initially, it is stored in the Global variable as a record.  Both the Default property and the DefaultSelectedItems are looking for a record.  All you have to do is put your Global variable in each of these properties and the person object is able to be evaluated and populate the dropdown.  Thanks for the input above, appreciate the time looking at this.  I will try the "patch" option on some of the things I encounter in the future where this seems to make sense to apply.

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,436)