cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dev85
Helper I
Helper I

Using a combobox searchtext as a new entry in a person type field

Hello everyone!

 

I'm building an app that it has a person type combobox field. I want to that, when you type a persons name and the name is not listed (because is not in the company directory), then when you submit the form it will save the text that is on the searchtext property. For doing that I'm using this simple If statement:

If(IsBlank(combobox1.Selected),combobox1.SearchText,combobox1.Selected)

When I tried to use this, powerapps says that "is an invalid argument type(record), expected a text value instead". I have used this statement before in other combobox with no problem, however they weren't a person type field. 

 

Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @dev85 ,

 

Maybe you could try the following formulas:

If(IsBlank(DataCardValue1.Selected.DisplayName),DataCardValue1.SearchText,DataCardValue1.Selected.DisplayName) 

Or 

If(IsBlank(DataCardValue1.Selected.DisplayName),DataCardValue1.SearchText,First(DataCardValue1.SelectedItems).DisplayName) 

 

 

Best Regards,

Charlie Choi

View solution in original post

7 REPLIES 7
Abhilash_Swain
Super User
Super User

Hi @dev85 ,
Please try with 

If(IsBlank(combobox1.Selected.Value),combobox1.SearchText,combobox1.Selected.Value)

 ComboBox1.Selected is a record  and Combobox.Selecetd.value /result  is a text.

 

Please give me a Thumbs up if I answered your question and mark it as a solution to help others.

Thanks

Abhi (LinkedIn)

dev85
Helper I
Helper I

Hi @Abhilash_Swain 

 

Actually I'd tried that before but as soon as a try to add the .Value it will instantly show me an error.

dev85_1-1661179003661.png

 

dev85_0-1661178877387.png

As you can see in the last screenshot, the error is only in the last part.

Hi @dev85 ,
Use DataCardValue1.SelectedText.Value.

 

Please give me a Thumbs up if I answered your question and mark it as a solution to help others.

Thanks

Abhi (LinkedIn)

Hi @Abhilash_Swain 

 

The SelectedText property does not appear for person type fields. 

Abhilash_Swain
Super User
Super User

Hi @dev85 ,
You can try this . First(DataCardValue1.SelectedItems).DisplayName

dev85
Helper I
Helper I

It didn't work either 😞 . It shows the same "is an invalid argument type(record), expected a text value instead" error

dev85_0-1661183593800.png

If(IsBlank(DataCardValue1.Selected),DataCardValue1.SearchText,First(DataCardValue1.SelectedItems.DisplayName))

 

v-yujincui-msft
Community Support
Community Support

Hi @dev85 ,

 

Maybe you could try the following formulas:

If(IsBlank(DataCardValue1.Selected.DisplayName),DataCardValue1.SearchText,DataCardValue1.Selected.DisplayName) 

Or 

If(IsBlank(DataCardValue1.Selected.DisplayName),DataCardValue1.SearchText,First(DataCardValue1.SelectedItems).DisplayName) 

 

 

Best Regards,

Charlie Choi

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,595)