Object must implement IConvertible

Object must implement IConvertible in Power Apps

In Power Apps when you do a Patch to create a new item or to update an existing item you migth have found the error Object must implement IConvertible

Object must implement IConvertible

You have figured out how to use the Patch function but when you run the code you get the following error:

The requested operation is invalid. Server response: … failed: Object must implement IConvertible

Most low coders will think of a nice car without a roof now!

It’s time for another real SharePain as this high code error message in a low code platform will confuse many people.

The requested operation is invalid. Server response: ... failed: Object must implement IConvertible

Patch the wrong way

We need to have a more detailed look at the code here.

Object must implement IConvertible in Power Apps Microsoft Power Apps Patch command wrong

In my code the TextInput1_1 control is holding the data that I want to use to update my list item in SharePoint. it is so easy to just type the control name and assume that all is ok.

Patch(
    'Training Records',
    Defaults('Training Records'),
    {
        Title: TextInput1_1,
        ...
    }
)

But this is wrong, TextInput1_1 is a control and not a piece of string (aka text). To get to the data in the control TextInput1_1.Text will need to be used.

Object must implement IConvertible in Power Apps Microsoft Power Apps Patch Command right

It is such an easy mistake to make, and such unclear error message to get.

Trying to understand the error message

Sorry we will have to go into coding language here. I’ve had a look around for an easy to understand explanation about IConvertible. From the referenced site I got:

Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value.

Any clearer now?

I prefer the following:

Turn something complicated into something simple.

So taking “Object must implement IConvertible” back into Power Platform language:

The TextInput control returns information that cannot be used as a text, number or date value.

Wouldn’t it be nice if complicated and difficult to understand error messages were translated into something more human like?

6 thoughts on “Object must implement IConvertible in Power Apps

  1. That is the best, and only, explanation of that error I have ever seen, and I have spend something like 7 hours on support calls with Microsoft support trying to remove that error. In my situation, the error was related to that specific problem though. I want to add, for the community, the solutions that MS Support attempted:

    Refresh the data source

    Okay, that about covers it. That worked in 1 of the three scenarios that inspired me to open a ticket. The other two were resolved by re-creating the code, as I recall.

    My take-away is that this error is triggered by more situations than the developers originally envisioned.

  2. Whew… Thanks for this comment. I simply changed it to .text and now I am happy and the previous hours of frustration are gone.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: