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 :
Customer experience | Sales, Customer Insights,...
Unanswered

How to know when to use lowercase attribute when updating via Web API

(0) ShareShare
ReportReport
Posted on by 5

Hi,
I am trying to update Lookup attributes of a quote via the Web API.
I understand that in case of custom objects I need to use the camelcase notation, while in case of system should use lowercase.
But how can I distinguish between system lookups that come from dynamics library (like msdyn_account) and those that are "real custom"?
To get the attributes info (of a quote, for example), I am calling /api/data/v9.0/EntityDefinitions(LogicalName='quote')?expand=Attributes
In the case of my custom attributes and those coming from msdyn_* package I am getting
IsCustomAttribute: true
So how can I tell?

Thanks,
Roy

I have the same question (0)
  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Are you sure that you need to use CamelCase for custom lookups? I think this was true for old rest endpoints but with web api you need to use all lower case. I did a quick try and the lookup field schema I see is all lower case-

    attribute.png

    Hope this helps.

  • gdas Profile Picture
    50,091 Moderator on at

    Use name(Logical Name) always for web API.

  • RoyW Profile Picture
    5 on at

    Hi,

    Thanks for the reply.

    Maybe I should emphasize that I am setting a Lookup value.

    Here is the field I am trying to set:

    GET /api/data/v9.0/EntityDefinitions(LogicalName='quote')?$expand=Attributes($select=LogicalName,SchemaName,AttributeType)

    {"@odata.type":"#Microsoft.Dynamics.CRM.LookupAttributeMetadata","LogicalName":"new_contactquote","SchemaName":"new_ContactQuote","AttributeType":"Lookup",..}

    I tested via Postman, when I try to update using camel case it works properly:

    Headers:
    • Accept:"application/json"
    • OData-MaxVersion:"4.0"
    • OData-Version:"4.0"
    • Content-Type:"application/json"
      {
      "new_ContactQuote@odata.bind":"/contacts(5da0e5b9-88df-e311-b8e5-6c3be5a8b200)"
      }

    Response is HTTP/1.1 204 No Content

    However, if I try to use the lower case notation I get an error:
    PATCH /api/data/v9.0/quotes(55603c18-2bf0-e911-a812-000d3a4a162c)

    {

    "new_contactquote@odata.bind":"/contacts(5da0e5b9-88df-e311-b8e5-6c3be5a8b200)"

    }
    Response:
    HTTP/1.1 400 Bad Request
    message:"An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'new_contactquote' 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.  ..."
    So just using the logical name does not work in this case.
    Is there another way of setting lookup values? If not, that brings me back to my original issue of how to tell when to use camel case and when to use lower case.
    Thanks,
    Roy
  • Saad Kabarousse Profile Picture
    734 on at

    Hello,

    Your error means that there is no field with a Logical name of "new_contactquote" in contact,

    Use the Solution of CRM Rest Builder it will help you a lot, it'll build your request and you may even test before add it to your JS Scirpt.

    Here's a link, add it to your CRM Organization and Use it to build ur O-DATA requests.

    github.com/.../CRMRESTBuilder

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans