Loading

APIkit for OData V4 | Invalid value for property of Edm.Decimal Type

Udgivelsesdato: Aug 6, 2025
Løsning

SYMPTOM

For a property of type "Edm.Decimal" defined in OData metadata, an error like below is thrown at runtime:
"message": "Invalid value: 772.23 for property: Total_amount"

CAUSE

The problem is most likely with the attributes Precision and Scale of the decimal property.

The attribute Precision specifies the maximum number of significant decimal digits of the property’s value; it MUST be a positive integer. If no value is specified, the decimal property has unspecified precision.

This attribute Scale specifies the maximum number of digits allowed to the right of the decimal point. If no value is specified, it defaults to zero.

For more information, refer to the following link:
https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752531

SOLUTION

Configure the attributes Precision and Scale properly for the decimal property in the OData metadata file to suit your needs.

For example, in src/main/resources/api/odata-metadata.csdl.xml:

<Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
Vidensartikelnummer

001117459

 
Indlæser
Salesforce Help | Article