1
votes

I'm attempting to add a button to the Activities grid ribbon to open a modal window that shows all the activities with latlng data on a map.

I have this working ok for a small number of activities, but once the selected number grows too large CRM has problems opening the modal window.

My current theory is that this is because the parameter string is too long to be passed via the GET method.

Is there a way to pass the SelectedControlSelectedItemIds to the web resource using POST rather than GET? I can't see any in TN docs*, but I'm hoping someone might have found a way.

*http://technet.microsoft.com/en-us/library/gg309332.aspx

Here's a snippet of the code I have at the moment:

<CommandDefinition Id="Mscrm.Isv.activitypointer.HomepageGrid.Group0.Control0">
  <EnableRules>
    <EnableRule Id="Mscrm.Enabled" />
  </EnableRules>
  <DisplayRules />
  <Actions>
    <Url Address="$webresource:as_cam_mapsa" WinMode="1" PassParams="true" WinParams="dialogHeight: 800px; dialogWidth: 1000px">
      <CrmParameter Name="data" Value="SelectedControlSelectedItemIds" />
    </Url>
  </Actions>
</CommandDefinition>
1

1 Answers

0
votes

Instead of using a html webresource, you could could call a javascript function with no parameters from the ribbon. Inside this javascript you can use something like this to get the selected ids:

document.getElementById("crmGrid").control.get_selectedIds();  

Now you can select if you want to use javascript / jQuery or another framework to build the whole dialog - or you can use showModalDialog in javascript to get the same dialog as crm uses. In any term you now have a litle bit more control on how the parameters are sendt.

You should also be able to use the code above inside your html webresources javascript by getting the parent window from dialogArguments that is sent by default to a modal dialog.

 window.dialogArguments.window.document.getElementById("crmGrid").control.get_selectedIds();