Get, Set and Update fields with JavaScript – Dynamics CRM

Usually it’s required to get, update or change fields dynamically with JavaScript. Find below some easy methods to achieve some of these necessities
// Get Field
var Field = Xrm.Page.data.entity.attributes.get("FIELD_NAME");
// Get Field value
var Field_Value = Xrm.Page.data.entity.attributes.get("FIELD_NAME").getValue();
// Set Field Value (String)
var Field_Value = Xrm.Page.data.entity.attributes.get("FIELD_NAME").setValue("HELLO WORLD");
// Set Field Label
Xrm.Page.ui.controls.get("FIELD_NAME").setLabel("EXAMPLE");

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s