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

Advertisements