Get/Set currency field values in JavaScript for Dynamics CRM

I noticed a peculiar scenario today in which currency field value on CRM forms were not accessible using Xrm.Page.getAttribute(“Currency field name”).getValue() and Xrm.Page.getAttribute(“Currency field name”).setValue(Value)

The resolution is in such cases you can access currency fields in below manner:

// To get currency field

Xrm.Page.data.entity.attributes.get(“Currency field name”).getValue();

// To set currency field

Xrm.Page.data.entity.attributes.get(“Currency field name”).setValue(Value);

 

Hope it helps!


Check this out

Trying to Learn Dynamics CRM: Download!

Learn Dynamics CRM App on Google Play store

Advertisement

13 thoughts on “Get/Set currency field values in JavaScript for Dynamics CRM

  1. Thank you for the post. When populating a Currency field in a CRM form, is there another attribute you have to set besides the .setValue?

  2. hello and thank you for the information,
    I am having the same problem but in Xml (or fetch xml ?) in CRM,

    I am extracting some information using a webgrid in asp.net that connects to CRM,

    all fields work fine, except the money field which instead of displaying the value, it displays: Microsoft.Xrm.Sdk.Money …. I al using a sitesetting with the entity “incident”

    I tried .Value and lot of stuffs but nothing works so far, do you have an idea ?

    Thanks in advance.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s