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

Getting an Error Saving Data From a Listbox to Sharepoint List

I created a listbox and trying to save the data to a sharepoint list. I get an error saying does not match the expected type 'table'. Found Type 'Error'. the code i am using is :

Patch(advisory, Defaults(advisory), {Title: CustomerName.Text, CustomerPhoneNumber: CustomerPhoneNumber.Text,  Email: Email.Text, BestToCall: bestTToCall.Text,City: City.Text, Zip:Zip.Text, DateOfReferral: 'Date of Referral'.SelectedDate,State: states.SelectedText, ReferredBy: RefferedBy.Selected.DisplayName, AreaOfInterest: ListBox3.Selected.Value }) 

the listbox is called ListBox3 and the column name in sharepoint is AreaOfInterest.

 

The settings I have on my sharepoint list column is below:

 

2019-09-23 10_18_25-Change Column.png 

 

Not sure what the problem is. I have beentrying everything I can think of and can't seem to get it working. Thanks for you help.

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

@alex5p 

 

SelectedItems wont work since it will return a collection

we are just trying to patch one item

You will need to get just the first value in the selected list to patch (***if that is the requirement)

 

Try First(ListBox3.SelectedItemsText).Value to see if you get the value and if yes then apply this to the patch action

in the table value format specified

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

14 REPLIES 14
Dual Super User
Dual Super User

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

Hi @alex5p 

 

Try 

AreaOfInterest: {Value: ListBox3.Selected.Value}

Reference: https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

alex5p
Level: Powered On

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

Hi @RezaDorrani ,

 

I just tried that and now it says expected type ' Table' . Found type 'Record'

Dual Super User
Dual Super User

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

@alex5p 

 

AreaOfInterest: Table({Value: ListBox3.Selected.Value})

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

alex5p
Level: Powered On

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

@RezaDorrani 

 

Sorry came back error again. Invalid Arguement type. Expecting a Table value, but a different schema.

 

Patch(advisory, Defaults(advisory), {Title: CustomerName.Text, CustomerPhoneNumber: CustomerPhoneNumber.Text,  Email: Email.Text, BestToCall: bestTToCall.Text,City: City.Text, Zip:Zip.Text, DateOfReferral: 'Date of Referral'.SelectedDate,State: states.SelectedText, ReferredBy: RefferedBy.Selected.DisplayName, AreaOfInterest: Table({Value: ListBox3.Selected.Value}) }) 
Dual Super User
Dual Super User

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

Hi @alex5p 

 

 ListBox3.Selected.Value

What data do you get from this?

Add a temporary label and set its text to 

 ListBox3.Selected.Value

See if the value you get matches one of the options in your choice list

 

 

 

alex5p
Level: Powered On

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

@RezaDorrani 

 

Getting Name is isn't valid. This idenifiter isn't recongized. And it has Value Underlined red.

 

2019-09-23 11_38_16-Referral System - Saved (Unpublished) - PowerApps.png2019-09-23 11_38_30-Referral System - Saved (Unpublished) - PowerApps.png

Dual Super User
Dual Super User

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

Hi @alex5p 

 

ListBox.Selected. - what does intelicense give you

what is the data source of this list box?

Is it multi select? Do you want users to multi select?

 

alex5p
Level: Powered On

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

Hi @RezaDorrani 

 

I am using a data soruce from onedrive. I am pulling an excel sheet with 10 department names for this listbox. For this particular case I want it just for 1 choice to be picked but I will need a multipicked listbox for another listbox I created. and I put Listbox3.SelectedItems and it said expected text value

Dual Super User
Dual Super User

Re: Getting an Error Saving Data From a Listbox to Sharepoint List

@alex5p 

 

SelectedItems wont work since it will return a collection

we are just trying to patch one item

You will need to get just the first value in the selected list to patch (***if that is the requirement)

 

Try First(ListBox3.SelectedItemsText).Value to see if you get the value and if yes then apply this to the patch action

in the table value format specified

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,907)