Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to patch entity with Customer data type using Web API

(0) ShareShare
ReportReport
Posted on by 245

Hi,

In Dynamics CRM 365 web api, how to perform a PATCH operation if the attribute is Customer data type. 

For example, in our custom entity, we have a custom attribute called mli_customerid and it's data type is Customer

pastedimage1599719172563v1.png

We wanted to update/patch this field using web API.

Please advise.

  • Suggested answer
    cloflyMao Profile Picture
    25,208 on at
    RE: How to patch entity with Customer data type using Web API

    Hi Benjamin,

    The format shall be schema name + _contact@odata.bind, I tested it in Postman with another custom entity.

    8562.MicrosoftTeams_2D00_image.png

    Please let me know whether it could work for you. :)

    Regards,

    Clofly

  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at
    RE: How to patch entity with Customer data type using Web API

    mli_customerid@odata.bind:"/contacts("guid")"
    or
    _mli_customerid_value@odata.bind:"/contacts("guid")"

    Please try the above and see if it works.

    As been stated above, please use the schema name of your field.

    Best Regards

    PG

  • Suggested answer
    cloflyMao Profile Picture
    25,208 on at
    RE: How to patch entity with Customer data type using Web API

    Hi Benjamin,

    It seems that the field is from a custom entity called "financial account", right?

    The sample I give is based on customer field of OOB Case entity, hence the error occurred: the property is not correct to update the customer field of your own custom entity.

    Please replace it with schema name of your customer field, 

    "new_Account_contact@odata.bind": "/contacts(DFE54660-37CD-E511-80DE-6C3BE5A831DC)"

    pastedimage1599728803773v1.png

    I created a custom entity called "financial account", then update an existing record by using above format expression  and it works.

    If it still not works, you can use CRM Rest Builder to get the correct property value.

    pastedimage1599728904790v2.png

    Regards,

    Clofly

  • Benjamin Fallar III Profile Picture
    245 on at
    RE: How to patch entity with Customer data type using Web API

    Yes, that's what my initial BODY was and here is the error

    "message": "An undeclared property 'mli_customerid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.",

  • Suggested answer
    cloflyMao Profile Picture
    25,208 on at
    RE: How to patch entity with Customer data type using Web API

    Hi Benjamin,

    In Postman, the format shall be below:

    "mli_customerid@odata.bind": "/contacts(DFE54660-37CD-E511-80DE-6C3BE5A831DC)"

    From posted screenshot of question of user, we can see it used above format to update the lookup/partylist field.

    https://community.dynamics.com/365/f/dynamics-365-general-forum/399201/deep-insert-custom-entities-1-n-relationship-odata-api

    Regards,

    Clofly

  • Benjamin Fallar III Profile Picture
    245 on at
    RE: How to patch entity with Customer data type using Web API

    Ok, yes I saw those samples in JScript, but if I'm using Postman to PATCH a request, what or how the format for the BODY?

  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at
    RE: How to patch entity with Customer data type using Web API

    Hello,

    You can try the below code.

    JSONCustomEntity["mli_customerid@odata.bind"] = "/contacts(DFE54660-37CD-E511-80DE-6C3BE5A831DC)" //Contact
    //In case of Account
    JSONCustomEntity["mli_customerid@odata.bind"] = "/accounts(DFE54660-37CD-E511-80DE-6C3BE5A831DC)" //Account

    ref: https://www.inogic.com/blog/2016/02/set-values-of-all-data-types-using-web-api-in-dynamics-crm/

    Best Regards

    PG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans