I have a subgrid which is n:n relationship to current record.
I want to add a filtered view to the “Add Existing” button of this subgrid.
Any idea?
(I followed this article which is exactly same as my requirements: http://danielcai.blogspot.com/2011/12/filtered-lookup-for-existing-button-of.html)
First, you have to export a solution containing the entity with the type you want to filter:
In the customizations.xml find the RibbonDiffXml node and add the following code:
And in the the CommandDefinitions node, add this:
The code comes from an XML file that you can find in the CRM 2011 SDK and has been modified to call a custom function from a custom Javascript Library.
Then, create the new JS library with the name specified above in the Library attributes.
Add a first generic function:
and finally, add the function which should be called by the button:
Publish everything and it should be ok!