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

Combo box for person/group column not saving

I have a combo box on a form, corresponding to a person/group column on a sharepoint list. I'd like the user to be able to either enter a person into this box that exists as a user from "all users" OR if the person does not exist in that user list, simply a plain text name.

 

I am having an issue where if the person does not exist in the user list from sharepoint and the user is not clicked when it pops up as a suggestion in the combo box, the form does not save the entry when it is submitted.

So my question is, is there a method of searching for a user in the sharepoint user list as well as allowing plain text name entries? I assume it only allows the pre-defined users as the items field contains a specific column of the sharepoint list: Choices(SHAREPOINTLIST.REQUESTED_BY) . However, I'm not sure how to allow other entries.

I'll attach an image to show the box when a user is entered that exists in the user list.

 

1.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Combo box for person/group column not saving

Hi @ppkeno,

Do you want to save a simply a plain text name from the Combo Box control into the Person type column in your SP list?

If the user does not exist in that User list, and you want to save a simply a plain text name from the Combo Box control into the corresponding Person type column into your SP list, I afraid that there is no way to achieve your needs in PowerApps currently.

If you want to save Person value from the Combo Box into your Person type column in your SP list, the person must be within the User List. Actually, when you save a Person value from the Combo Box into your Person type column in your SP list, it would save a Record value into your Person Type column rather than just a Text value.

Based on the needs that you mentioned, I think the Person type column in your SP list could not achieve your needs, instead, you could consider take a try to create Single line of text type column (called "Requester") to achieve your needs.

On your side, you could add a new Single line of text type column (called "Requester") in your SP list to store the Requester value, then create a new app based on your SP list. After that, within the Edit form, you could convert the Text Input box within the Requester Data card into a Combo Box control (remove original Text Input box, and then add a Combo Box control), set the Items property of the Combo Box control (ComboBox1) to following:

Office365Users.SearchUser({searchTerm:ComboBox1.SearchText})

Note: You need to add a Office 365 Users connection within your app.

Set the Update property of the Requester Data card which contains the Combo Box control to following:

If(
!IsBlank(ComboBox1.Selected),
ComboBox1.Selected.DisplayName,
ComboBox1.SearchText
)

then when you click "Submit" button, the corresponding value would be saved into the Requester field (Single line of text type column) in your SP list.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 REPLIES 6
Highlighted
PauwelsSven
Level 8

Re: Combo box for person/group column not saving

Hi,

 

Change the datacardvalue to 
If(ComboBox1.Selected.Name= "", ComboBox1.Selected.Name, ComboBox1.SearchText)

 

It will check if there is a name selected, if not it will take the plain text in the searchbox.

 

Regards

Super User
Super User

Re: Combo box for person/group column not saving

Hi @PauwelsSven,

This is a great solution and one that I wasn't aware of,  but I think you should warn the user to enter a full name (maybe with a label that pops up when a name is not found) or you will wind up populating your Combobox with partial names. 

Community Support Team
Community Support Team

Re: Combo box for person/group column not saving

Hi @ppkeno,

Do you want to save a simply a plain text name from the Combo Box control into the Person type column in your SP list?

If the user does not exist in that User list, and you want to save a simply a plain text name from the Combo Box control into the corresponding Person type column into your SP list, I afraid that there is no way to achieve your needs in PowerApps currently.

If you want to save Person value from the Combo Box into your Person type column in your SP list, the person must be within the User List. Actually, when you save a Person value from the Combo Box into your Person type column in your SP list, it would save a Record value into your Person Type column rather than just a Text value.

Based on the needs that you mentioned, I think the Person type column in your SP list could not achieve your needs, instead, you could consider take a try to create Single line of text type column (called "Requester") to achieve your needs.

On your side, you could add a new Single line of text type column (called "Requester") in your SP list to store the Requester value, then create a new app based on your SP list. After that, within the Edit form, you could convert the Text Input box within the Requester Data card into a Combo Box control (remove original Text Input box, and then add a Combo Box control), set the Items property of the Combo Box control (ComboBox1) to following:

Office365Users.SearchUser({searchTerm:ComboBox1.SearchText})

Note: You need to add a Office 365 Users connection within your app.

Set the Update property of the Requester Data card which contains the Combo Box control to following:

If(
!IsBlank(ComboBox1.Selected),
ComboBox1.Selected.DisplayName,
ComboBox1.SearchText
)

then when you click "Submit" button, the corresponding value would be saved into the Requester field (Single line of text type column) in your SP list.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ppkeno
Level: Powered On

Re: Combo box for person/group column not saving

@PauwelsSven

This method results in an error: "Invalid argument type" in the Items field. 

@v-xida-msft

I followed this method and it allows me to enter a user from the list and save when submitted, however a user not on the list does not save to the SP list when entered and submitted.

EDIT: I apologize, this does work! I was confused as the entry does not save in the field on the form like it would if the user was on the list. The entry correctly enters into the SP list however It doesn't save as a highlighted name in the field on the form. Is there a way to do this?

I thought i could possible set the default value to "ThisItem.Requester" But I get the error: "The property expects record values, but this rule produces incompatible Text values." which is likely the reason it is not showing there after being submitted.

Community Support Team
Community Support Team

Re: Combo box for person/group column not saving

Hi @ppkeno,

Have you solved your problem?

Could you please share a screenshot about the issue that you mentioned?

Based on the error message that you mentioned, I think there is something wrong with the formula that you typed within the Combo Box control.

On your side, please take a try with the following workaround:

Set the DefaultSelectedItems property of the Combo Box control to following:

{ 
  DisplayName: ThisItem.Requester,
  Claims:"i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(), DisplayName = ThisItem.Requester).Mail), 
  Department:"",  
  Email: LookUp(Office365Users.SearchUser(), DisplayName = ThisItem.Requester).Mail, 
  JobTitle:"", 
  Picture:""
}

Please check the following thread for more details:

https://powerusers.microsoft.com/t5/General-Discussion/Set-current-user-as-default-value-of-Person-o...

 

If you have solved your problem, please go head to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ppkeno
Level: Powered On

Re: Combo box for person/group column not saving

@v-xida-msft

Thankyou! If i manually enter a plain text string in the sharepoint list and refresh the app data sources, it displays highlighted as required.

Entering it in the app although, has now become near impossible. The drop down box is almost permanently open. If i enter "Test" into the field and click away it dissappears (the drop down menu is still open). Pressing enter does nothing. There's no way to enter a value into the field before I have a chance to submit the form as it seems the dropdown box being permanently open is preventing any text from being an input in the field.

EDIT: This behaviour can be bypassed by entering a user from the list, clicking the x and therefore deleting the entry. Then, an entry of a user not on the list can be made without issue.