Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Currency Field Not Able To Be Set From Javascript.

Posted on by 125

I am experiencing a strange issue when attempting to create a new entity record using JavaScript. The record gets created ok but one field with the schema name "manualdiscount" never gets set. This field is a currency field. The other currency fields such as costpriceperunit are set ok. Any one know what is happening here?

Below is  the object posted via the Javascript HTTP call. 

{ContractLineItem@odata.bind: "/products(5b36971f-0219-eb11-a813-000d3a7eef9e)",
quantity: 1,
revenuetype: 100000001,
division: 100000000,
costpriceperunit: 500,
manualdiscount: 10}

  • jonfarmer4999 Profile Picture
    jonfarmer4999 125 on at
    RE: Currency Field Not Able To Be Set From Javascript.

    Hi

    Thank you for your reply.

    Currency Precision is set to 2 throughout the system.

    The custom field is currency with Precision set to "Currency Precision" The Max and Min values allow for the value I am setting but I have noted that the Max and Min values are set to 4 decimal places. Could this be the issue?

    There is no error message and the part of the code that indicates the entity record was created is running. Looking at the system the entity record has been created minus the custom field value

    Regards

    Jon

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Currency Field Not Able To Be Set From Javascript.

    Hi, Jonfarmer4999

    I have tried to reproduce the issue but the values of Currency fields can be set normally.

    j1.png

    As your Entity and Field are custom, please provide me with the details of the field properties if possible.

    There are two main points that need to be focused on:

    1. The Precision of the two fields.

    j2.png

    If the Precision is set as ‘Pricing Decimal Precision’, it allows you to enable and set decimal precision for all supported price-related fields in the system.

    Pricing decimal precision can be defined in the Settings > Administration > System Settings > General tab.

    j3.png

    If the Precision is set as ‘Currency Precision’, allows you to enable and set decimal precision to individual currencies. To define this setting, go to Settings > Business Management > Currencies.

    j4.png

    2. The Minimum / Maximum Value of the field. Please check if the value you entered is outside this range.

    j5.png

    You can also add a console message into the JavaScript like:

    j6.png

    And if there is any error message, provide it to me please.

    Hope this will help 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans