Difference between CRM 4.0 and CRM2011 script for using on form customization

Difference between CRM 4.0 and CRM2011 script for using on form customization

 

Request To CRM 4.0 CRM 2011
Set Field Value crmForm.all.CRMFieldSchemaName.DataValue=Value Xrm.Page.getAttribute(CRMFieldSchemaName).setValue(Value);
Get Field Value crmForm.all.CRMFieldSchemaName.DataValue Xrm.Page.getAttribute(CRMFieldSchemaName).getValue();
Set requirement fields For No Requirement—————————— Xrm.Page.getAttribute(“CRMFieldSchemaName”).setRequiredLevel(“none”);
crmForm.all.CRMFieldSchemaName.setAttribute(“req”, 0); Xrm.Page.getAttribute(“CRMFieldSchemaName”).setRequiredLevel(“required”);
crmForm.all.CRMFieldSchemaName_c.className = “n”; Xrm.Page.getAttribute(“CRMFieldSchemaName”).setRequiredLevel(“recommended”);
For Recommended——————————  
crmForm.all.CRMFieldSchemaName.setAttribute(“req”, 1);  
crmForm.all.CRMFieldSchemaName_c.className = “rec”;  
For Required——————————  
crmForm.all.CRMFieldSchemaName.setAttribute(“req”, 2);  
crmForm.all.CRMFieldSchemaName_c.className = “req”;  
Enable/Disable fields crmForm.all.CRMFieldSchemaName.Disabled = true; Xrm.Page.getControl(“CRMFieldSchemaName”).setDisabled(false);
crmForm.all.CRMFieldSchemaName.Disabled = false; Xrm.Page.getControl(“CRMFieldSchemaName”).setDisabled(true);
Hide fields crmForm.all.CRMFieldSchemaName.style.Display = ‘none’; Xrm.Page.ui.controls.get(“CRMFieldSchemaName“).setVisible(false);
crmForm.all.CRMFieldSchemaName _c.style.Display =’none’;
Show fields crmForm.all.CRMFieldSchemaName.style.display = ‘block’;   OR Xrm.Page.ui.controls.get(“CRMFieldSchemaName“).setVisible(false);
crmForm.all.CRMFieldSchemaName.style.display = ‘inline’;
Get Pick list Value crmForm.all.CRMFieldSchemaName.DataValue Xrm.Page.getAttribute(“CRMFieldSchemaName”).getSelectedOption().text;
Set Pick list Value crmForm.all.CRMFieldSchemaName.DataValue= value; Xrm.Page.getAttribute(“CRMFieldSchemaName”).setValue(parseInt(Value));
Get Lookup value var lookupItem = new Array; var lookupItem = new Array;
lookupItem = crmForm.all.CRMFieldSchemaName.DataValue; lookupItem = Xrm.Page.getAttribute(CRMFieldSchemaName).getValue();
if (lookupItem[0] != null) if (lookupItem[0] != null)
{ {
 alert(lookupItem[0].name);  alert(lookupItem[0].name);
 alert(lookupItem[0].id);  alert(lookupItem[0].id);
 alert(lookupItem[0].typename);  alert(lookupItem[0].entityType);
} }
Set Lookup value var lookupData = new Array(); Xrm.Page.getAttribute(“CRMFieldSchemaName”).setValue( [{id: idValue, name: textValue, entityType: typeValue}]);
var lookupItem= new Object(); Or
   lookupItem.id = ‘guid‘; var value = new Array();
   lookupItem.typename = ‘entityname‘; value[0] = new Object();
   lookupItem.name = ‘TextVal‘; value[0].id = ‘guid‘;
   lookupData[0] = lookupItem; value[0].name = ‘TextVal‘;
   crmForm.all.CRMFieldSchemaName.DataValue = lookupData; value[0].entityType = typeValue;
  Xrm.Page.getAttribute(“fieldName”).setValue(value);
   
Tab Hide crmForm.all.tabIndexTab.style.visibility = “hidden”; Xrm.Page.ui.tabs.get(Tab Index).setVisible(false);
Xrm.Page.ui.tabs.get(Tab Index).setVisible(true);
OR
Xrm.Page.ui.tabs.get(Tab Name).setVisible(true);

 

 

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s