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,...
Answered

populating the currency field from c# code

(1) ShareShare
ReportReport
Posted on by 197
Hello everyone,

I have an asp.net API which performs some operations in Dynamics v9 environment.
 
I receive json with string values in it. For the currency field I convert text to Decimal and then set the currency field value like this:

orderEtn[crmField] = new Money(Convert.ToDecimal(fieldValue));
 
The issue is that foating points are not taken into the consideration. /35.5/ is converted to 355, /12.91/ converted to 1291 and so on.

When making same requests in the debug mode I don't have the same issue and everything works as expected.
 
Have you ever had such an issue ?
I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at
    to me looks like a regional format problem, in your machine you probably have the dot as decimal separator, where or who executes your c# code has the comma so when convert it changes 35,5 to 355
  • magical Khachapuri Profile Picture
    197 on at
    How can I take a look that those settings ? When searching for regional settings in windows I don't see any separator options listed.
  • magical Khachapuri Profile Picture
    197 on at
    Thanks Guido, you were correct.

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 83 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