Advertisements

Archive

Archive for August 8, 2011

Handling Tab click event in CRM 2011

Hi,

We can fire our own Jscript function on CRM tab click. Below are the steps

 How to get ID of Crm Form Tab :-

  • Get the ID of the ‘Tab’, using IE browser Developer Tool (i.e., Click F12)  (See image above)

Code :-

  • Attach “onclick” event handler on page ‘OnLoad’ method

function Form_onload() {
//Attach ‘onclick’ event handler to “Tab”
var linkGeneral = document.getElementById(“tab0Tab”);   //’tab0Tab’ is the ID of ‘General tab’
if (linkGeneral) {
linkGeneral.attachEvent(“onclick”, tab_onclick);

}

}

Function tab_onclick(){

//This function fires on Tab Click;

//Write your code

}

Hope it helps 🙂

Advertisements

Disabled fields in Bulk Edit Form – CRM 2011

August 8, 2011 3 comments

Hi,

In CRM, We can edit multiple records (i.e., Bulk Edit) at a time. To do bulk edits we have to follow below steps

  • Select multiple records from the view (or) Associated view
  • Click on “Edit” button on the Ribbon

– In CRM 4.0 and older UR’s of CRM 2011, once you get the Bulk Edit CRM Form, you would notice couple of fields on the form is in disabled state and you wonder why?

Reason:-

  • Fields with “onchange” event will be in disabled state on Bulk Edit Form in CRM 4.0 and older roll up’s of CRM 2011.
  • With latest UR’s of CRM 2011, by default fields are in enabled state however the scripts associated to fields onchange event are disabled.
  • This is because for multiple records, CRM won’t be able to trigger the OnChange event and take the defined action in OnChange Jscript
  • In simple words, By Default Form and field events are disabled for the bulk edit form.

To enable a field (event) in Bulk Edit Form:-

We can enable the field onchange event by changing entity customization

Steps:-

  • Export the entity as a solution
  • Open “customizations.xml” file using visual studio
  • Navigate to <events> node of the field and set “BehaviorInBulkEditForm” to “Enabled”
  • Import back the solution (See below for the node)
  • <events><eventname=onchangeapplication=falseactive=falseattribute=“{your_attributename}BehaviorInBulkEditForm=Enabled>
  • “BehaviorInBulkEditForm” has below 3 options
    • Enabled  –  If you use this value, the field is enabled. Additionally, the code for the event is run when the event is called.
    • Disabled – If you use this value, the field is disabled.
    • EnabledButNoRender – If you use this value, the field is enabled. However, the code for the event is not run when the event is called.
  • Refer this useful link (KB) on Bulk Edithttp://support.microsoft.com/kb/949941

Hope it Helps 🙂