So I have a People column in a form. Everything works, if I edit the item it shows me the user added to in people column and I can search and re-select another user and save.
But when I then want to limit the people that you actually can select from I use the following.
Item = Office365Groups.ListGroupMembers("Some Group ID here").value
Now I can only select from users that are in the group I specified, but saving the form results it no change even if I change the people I select. Also when I open a item in edit form, it no longer displays the user from in the people column even if I can see it's there in the SharePoint list
Solved! Go to Solution.
Hi @JimmyWork
This is not straightforward. Took a long time to find out the answer. Here you go
Set the Items property of Combo box to
Office365Groups.ListGroupMembers("Group GUID").value
Set the DefaultSelecteditems property to the Person combo box to
Office365Users.UserProfileV2(ThisItem.'PersonColumnName'.Email)
Set the Update Property of Person Datacard to
{
Claims: "i:0#.f|membership|" & Lower(PersonCombobox.Selected.mail),
Department: "",
DisplayName: Lower(PersonCombobox.Selected.displayName),
Email: Lower(PersonCombobox.Selected.mail),
JobTitle: "",
Picture: ""
}
My Example
Hi @JimmyWork
You are right. We need to validate blank as well. Here is the solution
Set the DefaultSelectedItems property to
If(
!IsBlank(ThisItem.AssignedTo.Email),
Office365Users.UserProfileV2(ThisItem.AssignedTo.Email),
Blank()
)
Set the Update property of the Card to
If(
!IsBlank(DataCardValue12.Selected.mail),
{
Claims: "i:0#.f|membership|" & Lower(DataCardValue12.Selected.mail),
Department: "",
DisplayName: Lower(DataCardValue12.Selected.displayName),
Email: Lower(DataCardValue12.Selected.mail),
JobTitle: "",
Picture: ""
},
Blank()
)
Important: To set a Blank value for the person field, we need to enable some settings
Thanks,
Stalin - Learn To Illuminate
Hi @JimmyWork
I assume you are using the form to edit the data. So
Set the DefaultSelectedItems property to person Combobox to
Parent.Default
and Set Update property of the Data card (Not Control) to
ComboBoxName.Selected
Hi @JimmyWork,
Do you want to save the combo box selected user to Person column and display the user when you edit the record?
Could you please share a bit more about the scenario?
Actually, the Update property of the data card corresponding to the Combo Box depends on how you set the Items property of the Combo Box. Since you have changed your Items property using the Office365Groups() function, I think you should do some modification on the Update property of the data card and the DefaultSelectedItems of the Combo Box.
I agree with @StalinPonnusamy that set the Update property as Combo Box selected to represent the expected record value. However, please try to modify your DefaultSelectedItems as below:
ThisItem.PersonColumnName.
Hope it could help you at some degree.
@StalinPonnusamy @v-qiaqi-msft
Thank you for answering.
This is my current setting in the Combo Box, default values not touched.
Yes I would like to save the combo box selected user to Person column and display the user when you edit the record.
Default = ThisItem.ColumnName
Update = DataCardValue12.Selected
DefaultSelectedItems = Parent.Default
This is not working, when I open a item in edit mode then nothing is displayed in the ComboBox even if the item has valid data. If I make a change and submit the form, no update happens.
Same if I set the DefaultSelectItems = ThisItem.ColumnName
I have tried everything here, no matter what I select it just wont show the the current data or save what I change in that field. By default everything works but as soon as I change the Items to the Office365 group values it stops working
Found this: https://powerusers.microsoft.com/t5/Building-Power-Apps/Office365Users-selection-is-not-submitting-t...
Also found an old issue from myself: https://powerusers.microsoft.com/t5/Building-Power-Apps/Person-column-and-SubmitForm/td-p/549235
That might solve the actual submitting of the form but not displaying the data the form contains when edited. Not sure why ThisItem.ColumnName does work to display the data from the People Column in the item
Hi @JimmyWork
This is not straightforward. Took a long time to find out the answer. Here you go
Set the Items property of Combo box to
Office365Groups.ListGroupMembers("Group GUID").value
Set the DefaultSelecteditems property to the Person combo box to
Office365Users.UserProfileV2(ThisItem.'PersonColumnName'.Email)
Set the Update Property of Person Datacard to
{
Claims: "i:0#.f|membership|" & Lower(PersonCombobox.Selected.mail),
Department: "",
DisplayName: Lower(PersonCombobox.Selected.displayName),
Email: Lower(PersonCombobox.Selected.mail),
JobTitle: "",
Picture: ""
}
My Example
Hi @JimmyWork,
I agree with @StalinPonnusamy, that you should try a different schema as below:
{
Claims: "i:0#.f|membership|" & xxx@123.Com,
Department: "",
DisplayName: xxx@123.Com,
Email: xxx@123.Com,
JobTitle: "",
Picture: ""
}
Please try the solution from @StalinPonnusamy and check if this could solve your problem.
@StalinPonnusamy Thank you so much, this solved it, will remember this solution now 🙂
And @v-qiaqi-msft thank you to for the help 🙂
@StalinPonnusamy Last question regarding this.
Everything works, but if the items people column is empty and i select edit then PowerApps throw the error, because the DefaultSelectedItem is empty, the end user does not see this at all so it's fine. But I guess I would need to do something like below, but is the below correct? It works but I'm not sure if it's the best practice to use Blank()
DefaultSelectedItem
If(ThisItem.AssignedTo.Email = Blank(), Blank(), Office365Users.UserProfileV2(ThisItem.AssignedTo.Email))
And update would be:
If(ThisItem.AssignedTo.Email = Blank(), Blank(),
{
Claims: "i:0#.f|membership|" & Lower(DataCardValue12.Selected.mail),
Department: "",
DisplayName: Lower(DataCardValue12.Selected.displayName),
Email: Lower(DataCardValue12.Selected.mail),
JobTitle: "",
Picture: ""
})
Hi @JimmyWork
You are right. We need to validate blank as well. Here is the solution
Set the DefaultSelectedItems property to
If(
!IsBlank(ThisItem.AssignedTo.Email),
Office365Users.UserProfileV2(ThisItem.AssignedTo.Email),
Blank()
)
Set the Update property of the Card to
If(
!IsBlank(DataCardValue12.Selected.mail),
{
Claims: "i:0#.f|membership|" & Lower(DataCardValue12.Selected.mail),
Department: "",
DisplayName: Lower(DataCardValue12.Selected.displayName),
Email: Lower(DataCardValue12.Selected.mail),
JobTitle: "",
Picture: ""
},
Blank()
)
Important: To set a Blank value for the person field, we need to enable some settings
Thanks,
Stalin - Learn To Illuminate
@StalinPonnusamy Thank you but I did not have to activate Forumla-level error management, it worked anyway 🙂
User | Count |
---|---|
254 | |
106 | |
96 | |
50 | |
39 |