Tuesday, October 18, 2011

Enable Scripts on Bulk Edit form in CRM 2011

CRM 2011 includes the feature to enable script on the bulk edit form. By default the scripts are disabled for bulk edit forms.

To enable the script for Bulk edit forms check the below syntax

<event
active=["0" "1" "true" "false"]
application=["0" "1" "true" "false"]
attribute="String"
BehaviorInBulkEditForm="String"
eventType=["DataEvent" "ControlEvent"]
name="String">
<dependencies />
<Handlers />
<InternalHandlers />
</event>

See below detailed descriptions for the attributes.




Steps to enable the script on bulk edit form:
- Include the entity for which you would like to enable the bulk edit script and export the solution.
- Open the customization.xml
- Add BehaviorInBulkEditForm="Enabled" to the event handlers as shown below


<event name="onload" application="false" active="false" BehaviorInBulkEditForm="Enabled" >
<event name="onsave" application="false" active="false" BehaviorInBulkEditForm="Enabled" >

- Save and Import the solution, publish it.
- Now your script will work on bulk edit form.

This way you can let your users use bulk edit freely with your custom script also executing just fine. Earlier, usually if there was custom business logic to be performed plugins were advised as it would allow the custom business logic to be executed for all records that were edited through Bulk Edit.

7 comments:

  1. Good work - I wasn't aware of this. Can you confirm whether this is Supported?

    ReplyDelete
  2. Yes it is supported and this has been described in the CRM SDK as well

    ReplyDelete
  3. Can you please show where in SDK is written that such kind of customization is supported?

    ReplyDelete
  4. In the SDK if you search by keyword BehaviorInBulkEditForm, you will notice a section with the above syntax explained.

    I assume since it is in the SDK, it is supported. Please correct me if this is otherwise

    ReplyDelete
  5. for me it did not work, any idea...
    i did d same way...

    ReplyDelete
  6. "< event name="onload" application="false" active="false" BehaviorInBulkEditForm="Enabled" > "

    "< event name="onsave" application="false" active="false" BehaviorInBulkEditForm="Enabled" > "

    I tried this in CRM 2011 with roll up 12,

    But for the Bulk edit, scripts are not working properly.
    Any thoughts?

    ReplyDelete
  7. Sorry for the delayed response.

    This continues to work on UR 12.

    Do you have multiple forms for an entity? If yes then make sure that you have added "< event name="onload" application="false" active="false" BehaviorInBulkEditForm="Enabled" > " line for every forms or any particular form for that you want to load a script.
    If you have 3 different forms for an entity, the customization.xml contains the three tags one each for every form. If you add the "< event name="onload" application="false" active="false" BehaviorInBulkEditForm="Enabled" > for only one form then bulk edit script will work for that form only.

    ReplyDelete