cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ztmcgoogan
Frequent Visitor

Server Response: Object must implement IConvertible

I've ran out of Google searches to try and fix my issue so hopefully someone here can lend a hand.

 

I have  gallery items that are imported from a Sharepoint list, users are able to select the ones they want (like a shopping cart) and then on a "submit" button , I need the selections to update a different SharePoint List but I keep running into the Iconvertible error.

 

I have stripped down by function to the following to remove all the variables I can think of but still no luck.

 

ForAll(OrderList, Patch(HSOrders,Defaults(HSOrders),{Title:Label9}))

 

Where the OrderList is my only collection, HSOrders is the Sharepoint List I am trying to update, currently the only column in the list that I am trying to update is the Title column, and Label9 is just a text field that is pulled from the gallery. 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@ztmcgoogan 

Whenever you see "deep" errors like that from a DataSource, something has gone wrong.  I would do the following:

1) Save and exit the designer

2) Go back in to edit

3) Refresh your datasource (the SharePoint list) in PowerApps

 

And, now to the formula (which, for the most part is correct).  You do have one issue.  It should be:

ForAll(OrderList, Patch(HSOrders,Defaults(HSOrders),{Title:Label9.Text}))

Now, I think you are just getting to this formula to troubleshoot and this is obviously not your intended formula.  So...we can cross that bridge more once you get past this.

But, definitely try those steps above.

 

I hope that is clear and helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

9 REPLIES 9
RandyHayes
Super User
Super User

@ztmcgoogan 

Whenever you see "deep" errors like that from a DataSource, something has gone wrong.  I would do the following:

1) Save and exit the designer

2) Go back in to edit

3) Refresh your datasource (the SharePoint list) in PowerApps

 

And, now to the formula (which, for the most part is correct).  You do have one issue.  It should be:

ForAll(OrderList, Patch(HSOrders,Defaults(HSOrders),{Title:Label9.Text}))

Now, I think you are just getting to this formula to troubleshoot and this is obviously not your intended formula.  So...we can cross that bridge more once you get past this.

But, definitely try those steps above.

 

I hope that is clear and helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@RandyHayes 

Thanks so much! It was the .text after my label that was causing the issue. That was a barebones formula just to try to get it to work as this was my first attempt at a patch but I've entered the rest of it in and tested and everything works as inteded. Again thank you for the help!

@RandyHayes 

 

Sorry, I actually have one more issue regarding this if your able to help. While the patch function is working and the Sharepoint List is updating, it's only adding what the first item is and then duplicating it by how many items are in the collection, so if I have five different items and the first one is a pen, I'll have five pen entries on the list instead of each individual item. Here is the full formula I am using.

 

ForAll(OrderList, Patch(HSOrders,Defaults(HSOrders),{Title:Title2.Text,ItemNumber:Label9_1.Text, SoldAs:Subtitle2.Text, Vendor:Label9_2.Text, OrderAmount:Label9.Text,DepartmentNumber: Label9_3.Text,Orderee: Office365Users.MyProfile().DisplayName, Date:Label3.Text}));

 

@ztmcgoogan 

I had a feeling we would get to this part of it.  I assumed you were testing out patching with your original problem, but, yes, what you have is going to do exactly what you see.

 

Now, I am not sure what you have in your OrderList as far as columns are concerned, but I'm going to take a guess that you have a Title, ItemNumber, SoldAs, Vendor, OrderAmount, DepartmentNumber, and OrderDate column.  Again, just a guess and am assuming you are collecting records in that OrderList for each item in your "cart".

With the above assumption, then your formula should be like this:

 

ForAll(OrderList, 
Patch(HSOrders,
Defaults(HSOrders),
{Title: Title,
ItemNumber: ItemNumber,
SoldAs: SoldAs,
Vendor: Vendor,
OrderAmount: OrderAmount,
DepartmentNumber: DepartmentNumber,
Orderee: Office365Users.MyProfile().DisplayName,
Date: OrderDate
}
)
);

As it was, your formula was referencing the individual text controls on your screen...which would be the same value for every record.  You need your formula to reference the columns in your OrderList as it is above.

 

Try to work that into your formula and see if you get the results you are looking for.  

If your OrderList does not have the information needed to complete the formula above, then perhaps we should look at how you are collecting records into that orderlist collection.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Just confirming to @RandyHayes 's solution - it just happened to me on a fairly large Patch.

It refused to work (with this error on multiple attempts and refreshes) in Studio design after running code.

Saved and exited and worked perfectly on re-entering.

I have a issue along the same lines.  I have refreshed the db and the other steps you outlined.  But still getting the runtime issue.  I am also trying to write to SP Lists. Code added.

Warehousetechie_0-1609416782919.png

 

Sorry, He is the error code from Power Apps:

Warehousetechie_1-1609417026715.png

 

Oh, you're a genius! 🙏

vish3027
Helper IV
Helper IV

Thanks This helps

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,198)