Hi All,
The default:
{
DisplayName: Office365Users.UserProfile(Manager.email).DisplayName,
Claims: "i:0#.f|membership|" & Lower(Manager.email),
Department: "",
Email: Manager.email,
JobTitle: "",
Picture: ""
}
I have a combobox that for people data, I was able to add the default value (as above), but now I need to check on change if the person which is the default value is not in the SelectedItems if so then readd to the combo box. Anyone has any idea how I can do that, I tried with patch and with collect but it does not seem to work.
Solved! Go to Solution.
Hi @RandyHayes,
I wasn't.
The collection was filled with the first item which is the person's Manager. But I fixed it by resetting the form from the OnSelect property in the gallery.
Thanks for taking the time.
Can you describe more about what you mean by "readd to the combo box"?
Also, you mention this is a combobox - The default property is pretty much meaningless on a Combobox. The property you want to set on a combobox is the DefaultSelectedItems property.
Hi @RandyHayes, I had an issue with the card. The card default was only accepting a record, I had to re add it from the form to have a collection/table as default.
Funny thing is that I now realize that even the defaultSelectedItems is not working. The value only appear when I change the combobox items. Basically I was able to it with the following:
Set the defaultSelectedItems to _glb_colCc and OnChange to:
If(Not(LineManager.email in DataCardValue1.SelectedItems.Email),
ClearCollect(_glb_colCc,{
DisplayName: LineManager.displayname,
Claims: "i:0#.f|membership|" & LineManager.email,
Department: "",
Email: LineManager.email,
JobTitle: "",
Picture: ""});
Collect(_glb_colCc,DataCardValue1.SelectedItems);
Reset(DataCardValue1);
)
Now I want to understand why the value only appears if I change the combobox, I even tried to reset it after setting the collection.
Your value would only appear after you change because you are only setting your items in a collection which would be empty up until the point that you change the selection.
So, pre-populate the _glb_colCc collection with the items you want.
However, you might want to reconsider your approach to this as you will eventually end up with a circular reference because you really DON'T want to reset the control as that will wipe out the selections that you
If(
!(LineManager.email in DataCardValue1.SelectedItems.Email),
ClearCollect(_glb_colCc,
DataCardValue1.SelectedItems,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
DisplayName: LineManager.email,
Claims: "i:0#.f|membership|" & Lower(LineManager.email),
Department: "",
Email: LineManager.email,
JobTitle: "",
Picture: ""
}
)
)
Again, you will need to prepopulate the _glb_colCc collection somewhere, like OnVisible of screen. Otherwise it will be empty until you actually change the combobox.
Hi @RandyHayes,
I wasn't.
The collection was filled with the first item which is the person's Manager. But I fixed it by resetting the form from the OnSelect property in the gallery.
Thanks for taking the time.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
212 | |
194 | |
82 | |
59 | |
38 |
User | Count |
---|---|
305 | |
255 | |
120 | |
86 | |
55 |