web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Plugin to capture Export details

(0) ShareShare
ReportReport
Posted on by 5

Hello All,

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 ?

Kind Regards,

Abhilash Reddy

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hi, 

    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

  • meelamri Profile Picture
    13,216 User Group Leader on at

    Hi,  any news ?

  • Abby546 Profile Picture
    5 on at

    Dear Mehdi,

    Thank you for the information. Will let you know the status soon.

    Kind regards,

    Abhilash.

  • Abby546 Profile Picture
    5 on at

    Dear Mehdi,

    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?

    Regards

    Abhilash.

  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hi,

    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

  • meelamri Profile Picture
    13,216 User Group Leader on at

    This approach remains valid for an on premise CRM

  • Abby546 Profile Picture
    5 on at

    Dear Mehdi,

    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.

    Regards,

    Abhilash.

  • Wilmar Neto Profile Picture
    10 on at

    Hey Mehdi,

    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.

    Thank you

  • meelamri Profile Picture
    13,216 User Group Leader on at

    Hi,

    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"))

  • Wilmar Neto Profile Picture
    10 on at

    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 :(

    pastedimage1633007538937v1.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans