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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Pass null value to cus...
Finance forum

Pass null value to custom fields in Odata call

(0) ShareShare
ReportReport
Posted on by 70

Hi,

 I have created custom fields in LogisicsPostalAddress table.  I am pushing data through Postman using Odata call.

Below is my request in postman Odata post call

 {

                "dataAreaId": "USRT",

                "CustomerLegalEntityId": "USRT",

    "CustomerAccountNumber": "1001",

                “AddressStreet": "3900 Great Plains",

                "AddressCity": "City1",

     "AddressZipCode": "58104",  

                "AddressCountryRegionId": "USA",

                "AddressDescription": "Address_check",

                "CustomField": null

}

 

If I pass value null to custom fields , it is throwing error as

 “An exception of type 'System.NullReferenceException' occurred in aoskernel.dll but was not handled in user code”

 "internalexception": {

                "message": "Object reference not set to an instance of an object.",

                "type": "System.InvalidOperationException",

                "stacktrace": "   at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataEntityDeserializer.ReadODataBody[T](HttpRequestMessage request)"

 But if I pass null to standard fields as below it is not throwing any error and creating the record.

{

                "dataAreaId": "USRT",

                "CustomerLegalEntityId": "USRT",

    "CustomerAccountNumber": "1001",

                “AddressStreet": "3900 Great Plains Dr S",

                "AddressCity": null,

    "AddressState": null,

                "AddressZipCode": "58104",  

                "AddressCountryRegionId": "USA",

                "AddressDescription": "Address_check",

                "CustomField": “Sample value”

}

 Can someone please let me know what should I do so that I can pass null values to custom fields as well

 Thanks

I have the same question (0)
  • praneethkumar.d365 Profile Picture
    70 on at

    Does any one has any idea on this ?

  • Suggested answer
    Jie G Profile Picture
    Microsoft Employee on at

    Hi praneethkumar,

    After checking the Mandatory property of LogisticsPostalAddress's field "City" and "state", It has been set to "NO". So they can be Null. How do you set the this property of the customer field "CustomField". Please check it.

    0844.0.PNG

  • praneethkumar.d365 Profile Picture
    70 on at

    Hi Ada,

    Even the custom field I created is not a mandatory field.

    My question is when I create custom fields in the standard table and use it in standard data entities and pass null (not empty string) to custom field it is throwing error but for standard field if

    I am passing null (not empty string) it is not throwing any error as described above.

    Thanks

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans