// JavaScript/JScript in CRM 2011 | CRM 2011 Training Series
// How to Get the label of the control using Javascript?
    Xrm.Page.ui.controls.get(‘<Attribute Name>’).getLabel()
    // Get record id
    Xrm.Page.data.entity.getId()
    // set field as required based value of a check box field.
    function OnChangeBoolField()
    {
    var varBool = Xrm.Page.data.entity.attributes.get(“<Boolean Field Name>”).getValue();
    if(varBool == false)
    {
     Xrm.Page.getAttribute(“<Attribute Name>”).setRequiredLevel(“required”);
    }
    else
    {
     Xrm.Page.getAttribute(“<Attribute Name>”).setRequiredLevel(“none”);
    }
    }
**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.
Advertisements