Bulk edit for Dynamics CRM Entities

September 10, 2008 Marco Amoedo 1 Comments

You probably already know about a feature calledbulk edit on Microsoft Dynamics CRM that lets you modify several records at once, this is definitely a great feature that enables end users to change in bulk some values for several records. The problem is that this feature is not available for all the records in Microsoft Dynamics CRM, but as usual with some dirty and UNSUPPORTED tricks this can be done.

Recently, I was playing with this feature trying to find how it works and see if it could be possible to enable it for the Sales Order entity. My first idea as usual was to dig on the internals of the CRM’s JavaScript to see what dialogue or URL is this “Bulk Edit” option calling.

With my brand new Internet Explorer 8 Beta 2, I will dedicate a post to it in another moment but just let me say it is worth to give it a try, I started the new integrated Developer Toolbar. This toolbar basically lets you do the same things as the older plug-in IE Developer Toolbar available for IE 6 and 7, so you get sort of HTML inspector/debugger that let you dig onto the HTML, CSS and all the JavaScript code that is included on the web page that you are browsing. Looking into the on click event of the menu item for Bulk Edit on the contacts grid I found a very simple call to a function called doAction(…), and it did not take too longer to find the function definition on the JavaScript included files.

This function seems to be utilised in all the Microsoft Dynamics CRM grids to manage the typical options that you have in the grid buttons and menus. Basically, this function gets some parameters to indicate the grid that is calling the function, the entity type code and what operation to execute.

In this case, we want to get this function to fire a Bulk Edit dialogue for the Sales Order entity so the call to the function would be like this doAction(‘crmGrid’,’1088′,’bulkedit’).Where crmGrid is the name of the object that represents the Grid, we will go through this object another day as it quite useful to handy multi selection buttons on the grid, the second parameter is the entity type code for the Sales Order entity and the final parameter is the command that we want to execute.

Finally, if we edit the ISV.config file (by exporting it and re-importing it) and add a new button definition for the Sales using JavaScript to execute this function call we get the Bulk Edit functionality working!

Here is the chunk of code that we need to add on the ISV.config file under the tag.

<Entity name="salesorder">
  <Grid>
    <MenuBar>
      <Buttons>
      <Button Icon="/_imgs/ico_18_debug.gif" JavaScript="doAction('crmGrid', '1088', 'bulkedit');" Client="Web">
        <Titles>
          <Title LCID="1033" Text="Bulk Edit" />
        Titles>
        <ToolTips>
          <ToolTip LCID="1033" Text="Bulk Edit." />
        ToolTips>
      Button>
      Buttons>
    MenuBar>
  Grid>
Entity>

Hope you find this useful but remember that this is a NOT SUPPORTED customisation and you should carefully test it to avoid any problem.

I didn’t try to add this functionality to other CRM Entities that don’t support

1 people reacted on this

  1. Please help, I tried creating a Bulk Update button on the ACtivities grid but have had no luck.

    This is the code in ISV.Config

    crmGrid = My Activities ?

    Many thanks

Comments are closed.