Search This Blog

Sunday, October 22, 2017

RetrieveMultiple Plug-in not Firing when Exporting Records via the View (Dynamics CRM 2015)

Hi all,

Recently at work I came across an issue where business users reported getting different results for a specific entity when viewing results for a query in a view vs attempting to export records to a spreadsheet via the 'Export Records' feature.

A little investigation revealed that there was a plug-in registered on RetrieveMultiple message for that entity that was excluding a specific subset of records based on filter criteria defined in the plug-in in addition to the filter criteria defined in the view. This subset of records had more technical importance and less business importance and were irrelevant to the business users, hence the exclusion.

The result set was correctly displayed when viewed in the view. However when exporting the records, the filter criteria defined in the view was working but filter criteria in the plug-in was not firing, thus the subset of records was not getting excluded. Looking at the plug-in code, I noticed, the plug-in had a Maximum Depth defined to 1.

Take a look at the code snippet below:


1:      public void Execute(XrmPluginContext context)  
2:      {  
3:        var depth = context.PluginExecutionContext.Depth;  
4:        if (depth > 1)  
5:        {  
6:          return;  
7:        }  
8:        ProcessRetrieveMultiple(context);  
9:      }  

I changed the plug-in maximum allowed depth to 2 and re-registered the plug-in, like so:


1:      public void Execute(XrmPluginContext context)  
2:      {  
3:        var depth = context.PluginExecutionContext.Depth;  
4:        if (depth > 2)  
5:        {  
6:          return;  
7:        }  
8:        ProcessRetrieveMultiple(context);  
9:      }  

I re-registered the plug-in, refreshed the view and exported the records in the spreadsheet. This time, the result set in the view and the spreadsheet matched. Further research revealed that in CRM 2015 and onwards, exporting records triggers the plug-in with a depth of 2 in a single transaction context. I hope this helps anyone facing similar issue and looking for resolution.

Until next time, Happy CRMizing!

Monday, October 16, 2017

Microsoft Dynamics 365 - Getting Started, Training Material


Hi all,


As I was going through training content about Microsoft Dynamics 365, I decided to create a repository of great content that is out there so I do not have to keep calling Mr. Google and have it accessible as I need it, and for all of you out there looking. So let's start...


Microsoft Virtual Academy

I found a Microsoft Virtual Academy video course that is compiled for beginners but also gives valuable insight to seasoned CRM functional analysts and developers into key new concepts and functionalities.

The videos are divided into modules so you can access them topic by topic. Best of all, if you create a Microsoft Virtual Academy account, it keeps track of modules you completed and saves your progress within a video. This way the next times you log on, you know where you left of.
You can access it here.



Help Hub

With the release of Dynamics CRM 2016 and Dynamics 365, Microsoft has made a big leap forward in terms of educating users on how to use the system with context driven and interactive step by step guide. It also contains numerous resources on learning Dynamics 365. These resources include, eBooks, Videos and Articles that help you learn at your own pace.

You can access it here.
So there you have it for now. I will update this post with more great stuff as I come across more.
Until next time, Happy CRMizing!

References