NEVER give your SharePoint fields the displayname of Value!

After an hour of banging my head against a brick wall when my Patch command failed I found the issue with a field named Value.

Value

It is not uncommon to call a field Value inn SharePoint. For example when you want to keep track of the Value of products you might think that Value is a good name. But it is not if you use Power Apps in combination with SharePoint.

The word Value is a reserved word in Power Apps as you might have found before. But what if your datasource uses a field called Value? Will things get confused?

Today I tried the following code:

Patch(
    'Gift, Hospitality and Donation Register',
    Defaults('Gift, Hospitality and Donation Register'),
    {
        TSTType: {            
            Value: First(cmbType.SelectedItems).Value
        },
        TSTValue: 123
    }
)

All looks good but Power apps is complaining that something is missing with the following warnings:

Invalid argument type.Expecting a Record value, but of a different schema.
Invalid argument type.Expecting a Record value, but of a different schema.

When you search for the above warnings your will end up on community posts where people have used the wrong syntax or when they are doing something else wrong. Or on my post about patching any type of field.

Fixing the column name

But to make matters worse! When you update the list’s column display name to for example Amount and then update your datasource. You will find that Power apps is trying to be very helpful! And all your “Value:” bits in your code will be updated.

Fixing the column name
Fixing the column name

Recommendations

So my recommendation:

Never call your fields Value. And that includes the displayname of a column. Well that is until Microsoft fixes this issue.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. You can contact me using contact@sharepains.com

Related Posts

Leave a Reply

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

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading