Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Error Using Patch to Create Record with Polymorphic field

I have a convas app draws data from the CDM. I have a custom entity with a customer lookup field. I am able to update records including the the customer lookup field with my current patch command. However when I attempt to use the same command to create a record with a value populated for the customer lookup field, I receive the following error but only if I include the polymorphic value. Without that value the create works without issue. The property being called in the patch command is _customvalue_value. I have tried adding a _customvalue_type but it says it is not a valid column because it does not exist.

Annotation 2019-09-26 132622.png

Super User
Super User

Hi @JohnBrown,

Can you post a screen shot showing how you populate your lookup field before patching your record please ?


@R3dKap  Sure, see below,

The Lookup has Items:

Annotation 2019-09-27 074351.png

And the Radio_DonorType is just two radio options of account and contact(UI has Individual and Organization but nehind the scenes it translates to the appropriate value). It has the following default setting to populate it. I am able to edit both types with the radio button and it updates the items on the lookup as expected. It is only the creates that seems to have a problem. 

Annotation 2019-09-27 074804.png



Hi @JohnBrown,

I don't know about polymorphic lookups in CDS but reading your initial post made me realize that you're facing the problem only in CREATION mode, not in UPDATE mode.

Would you mind posting a capture of your PATCH call in CREATION mode please ?



@R3dKapsure, the patch command is the same for edit and creation see below:

Annotation 2019-09-27 124733.png



Impactful Individual
Impactful Individual

Hi @JohnBrown 

At first glance at you posted formulas, I believe you are using deprecated old notation for lookups with *_value and *_type.
This isn't valid anymore with recent PowerApps releases (since a few months) which have the "Relational Data, option sets, and other new features for CDS" preview feature turned on by default.
The same applies to the deprecated *_label and *_value notation for multiselect option fields.

Have you seen this piece of documentation?
It shows how things are done with the new, more comfortable notation.
In particular, you'll want this:
Regular lookups work just the same.
You mentioned customer, so see also this, a bit further down the page. image.png

You can probably also use the typed versions (I'm in German language instance, Kontakte=Contacts, Besitzer=Owner, Benutzer=User, Team=Team, Unternehmenseinheit=Business Unit), that you can find with the auto-completion.

Note that it's just this easy, if you put in a proper record straight from the source.
Putting in something from Global variables, Context variables, or local collections is more complicated.

Also, note that the new features do, for all intents and purposes, require you to be online.
The old _label, _value, _type stuff worked offline basically out of the box.
Offline functionality with the new features is more complicated.

Best of luck,
    Sa Wu.

@SaWuThank you for the advice. I have looked at that article. To make it more closely align with it, I made the following changes

-Updated to use the regular name and not _customname_value

-Shifted to two comboboxes one for contacts and one for accounts and pass in the value based on the radio button value

but still receive the same error.


Annotation 2019-09-27 142201.png

Impactful Individual
Impactful Individual

Hi @JohnBrown 

Yeah, I get the same error for trying with a "Customer" field for a custom entity
It looks like they changed things again and the documentation isn't really working.
I just tried the embedded Owner example and get this:
For now it looks we're out of luck.

Maybe you can use one lookup field each to Contacts and Accounts (and optionally a business workflow to set the customer field from the Contact/Account field inside Dynamics) as a workaround?

Best of luck,
    Sa Wu.

Hi, im having the same issue trying to create new Case (Incident) with CustomerId polymorphic field.

Error Message:

"An error occurred while validating input parameters: Microsoft.OData.ODataException: A property '_customerid_value' which only has property annotations in the payload but no property value is declared to be of type 'Edm.Guid'. In OData, only navigation properties and named streams can be represented as properties without values.

My Patch code on button select:

        title: DataCardValue10.Text,
        _customerid_value: First(
                'Contact (contactid)' = Dropdown5.Selected.'Contact (contactid)'

Upon submitting, i see that the "Request Payload" JSON (in developer tools) is:


However, when generate a jQuery API using the CRM RestBuilder, the syntax is:

var entity = {};
entity["customerid_contact@odata.bind"] = "/contacts(78d62f07-716d-e911-a95c-000d3a34e4b0)";
entity.title = "test123";

Is this a Microsoft Issue? Else, a little help would be much appreciated. Thanks!

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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