cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dodge
Advocate I
Advocate I

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
Community Support
Community Support

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

yashag2255
Dual Super User II
Dual Super User II

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!

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
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (43,579)