0
votes

I am currently looking to disable bulk editing on all but a few entities, one of these being the "Campaign Response" entity.

To acheieve this I have done the following:

  • Hide the OOTB edit button at a global level (As far as I know you can't edit OOTB ribbon buttons in this way)
  • Create a new custom edit button at a global level (minus the SelectionCountRule node)
  • For each entity which I need bulk edit on:
    • Hide the custom edit ribbon button
    • Create a new custom edit button with SelectionCountRule node.

Now this all works fine until I goto the activities sub grid on any entity. Due to the way I've approached this problem, there are now 2 edit buttons present on the activity form (one for the regular edit button and one for the campaign response's edit button).

I'm not sure how to fix this exactly but i have an idea which I'll need some help with:

  • Delete the "bulk edit" edit buttons
  • At a global level, add JavaScript in the custom edit button's selection rule
    • JavaScript will obtain the selected entity's logical name (on all subgrids)
    • If the entity is campaign response, enable (or append?) SelectionCountRule to the ribbon

I'm not sure if this is possible. I'm unsure mainly around what the JavaScript to ribbon enable rules allow for

1

1 Answers

0
votes

Nevermind guys,

Turns out all I had to do was override the OOTB button (As shown here: http://howto-mscrm.blogspot.com.au/2011/04/how-to-series-6-how-to-overrideenable.html) with some simple XML:

<EnableRule Id="sample.AllGrids.AllEntities.MainTab.Management.Edit.Command.EnableRule.CustomRule">
  <CustomRule FunctionName="canBulkEdit" Library="$webresource:new_sample_generic_functions_javascript_library">
    <CrmParameter Value="SelectedControlSelectedItemCount" />
    <CrmParameter Value="SelectedEntityTypeName" />
  </CustomRule>
</EnableRule>

and some JavaScript:

canBulkEdit = function (oSelectedControlSelectedItemCount, oSelectedEntityTypeName) {
    var canBulkEditEntity = false;
    if (oSelectedControlSelectedItemCount < 2 || oSelectedEntityTypeName == "campaignresponse")
        canBulkEditEntity = true;

    return canBulkEditEntity;
}

Also had to do some additional tweaks to the ActivityPointer "Entity". Turns out the activitypointer has a different bulk edit button