Here is the scenario: there is a client-side java script, and we need to:
– Initiate some server-side processing
As of now, the only type of server-side processing we can use in Dynamics CRM online is called “plugins”, though. So, can we use CRM plugins in the scenario described above?
Surprisingly, the answer is yes.
There is another solution which still requires a dedicated entity type, but no CRM records of that type will ever have to be created. Here is how it works:
- We need to register a post-operation plugin on “RetrieveMultiple” for that entity
- We also need to register a pre-operation plugin on “RetrieveMultiple” for that entity
Basically, all we have to do in the pre-operation plugin is to extract request parameters from the fetch xml and pass those parameters to the post-operation plugin through the SharedVariables collection of plugin context.
In the post-operation plugin, we can do whatever server-side processing we need to do (based on the request parameters that we’ve already extraced in the pre-operation), and, once it’s done, we can populate [“BusinessEntityCollection”] member of the context output parameters collection (in case with this property, we can’t do it in pre-operation.. so, again, we need both pre and post-operation plug-ins in this scenario).
Just to add a bit more clarity, here is a quick diagram:
Finally, here is a real-life scenario where I used this approach:
- On the other hand, it’s not a problem at all to implement that sort of verification in C#