Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
We have a requirement to capture the logging information when anyone export data and generate notifications.
We need to know what entity was exported, how many records, and columns detail.
Is this possible via Plugin or Custom WF or any third party tool ?
You can implement a Plugin for this scenario. Indeed, the plugin will run on the retrieveMultiple message and check if the parent context is "ExportToExcel" or "ExportDynamicToExcel".
You can refer to my plugin: https://github.com/melamriD365/MEA.DynamicsServerExtensions/blob/master/PreOperationExportToExcel%20.cs
Hi, any news ?
Thank you for the information. Will let you know the status soon.
I just wanted to know can we capture the View name and also the columns which were exported in the plugin?
Also we are using Dynamcis 365 On-Premise version, does the plugin works in on premise or only in the online version?
I think we can at least collect the exported columns. I'm not sure about the view name.
You can get the fetchXml by using this code:
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
var fetchXml = context.InputParameters["Query"];
Then you can convert the fetchXml to a queryExpression by using FetchXmlToQueryExpressionRequest. Please refer to the docs example: docs.microsoft.com/.../microsoft.crm.sdk.messages.fetchxmltoqueryexpressionrequest
Then you can get the exproted columns from the queryExpression with QueryExpression.ColumnSet
This approach remains valid for an on premise CRM
We are able to log the user information who did the export including the columns and also the fitler criteria.
Thank you for the help. I marked your answer as verified.
Do you know if this approach still working on CRM Online?
I found your code in your git, but the parent context message is RetrieveMultiple too.
Normally, this will work on an online CRM too. I don't know if there are any changes since I shared my code.
I recommend looking at the parent contexts, you will need to debug to know the right context to use.
var parentContext = context.ParentContext;
var grandParentContext = parentContext.ParentContext;
if (grandParentContext != null && (grandParentContext.MessageName == "ExportToExcel" || grandParentContext.MessageName == "ExportDynamicToExcel"))
Thank you for your reply Mehdi.
In fact, i'm debugging, but the "grandParent" is null. Check this out.
I think something change in CRM since your code :(
I have used the plug-in on retrieve multiple message with none entity to track users who performed export to excel.
The main thing I am capturing is the count of the records, I’m capturing all info in a custom entity.
When user exports more than 5000 rows for example 95000 rows the plug-in triggers for every 5000 rows and creates new custom entity records for every 5000 records.
I registered this plug-in in post operation.
We are using dynamics 365 on premise.
Do you have any idea on how to stop the plug-in to trigger multiple times.
I used context depth check also.
I didn't expect the platform to react like this. I will investigate further to find a more efficient and more complete solution. Thanks for sharing your feedback.
Business Applications communities