web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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.

I have the same question (0)
  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at

    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

  • Benjamin Fallar III Profile Picture
    245 on at

    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
    cloflyMao Profile Picture
    25,210 on at

    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

    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,210 on at

    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

  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at

    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,210 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 74

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans