9 Jun’17

Dynamics 365, Enterprise, Dynamics AXOverride Form DataSource method using Extensions in D3fO

In this blog article, we will see how we can override Form Data source method using Extensions in Dynamics 365 Operations. Now as recommended by Microsoft we must avoid Overlayering and instead use Extension. For extension, we have to use pre or post event handlers methods. In this blog we will create event handler of OnActivated() method of SalesLine DataSource of form SalesTable.

Create a new Class:

class CFSActivateButton


Copy and paste OnActivated() event handler of SalesTable DataSource in Class:


/// <summary>
/// To activate or deactivate Create Service Order button based on CFSProjId field of SalesLine
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

[FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesLine), FormDataSourceEventType::Activated)]
public static void SalesLine_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)

        FormDataSource      fds = sender.formRun().dataSource("SalesLine");
        SalesLine           salesline = fds.cursor();
        FormRun             fr = sender.formRun();
        FormControl         fc = fr.design(0).controlName("CreateServiceOrder");       



Written by

Sohagani Shah

ERP Developer

One thought on “Override Form DataSource method using Extensions in D3fO”

  1. I tried overriding form data source active method using OnActivated event handler but the event handler runs first then the standard active method code runs after hence can’t override. Is there another way of archiving this?

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Dynamics 365 Client Diagnostics

    15 March’ 2018

    Main cause of Performance Issues: Bandwidth and latency are the primary characteristics which affects the performance o...

    Read more
  • Closing Blind Shift in MPOS and CPOS in Dynamics 365 for Retail

    15 March’ 2018

    Manual For closing Blind shift in POS: Blind shifts terminate the currently ongoing shift and when logged in a new shif...

    Read more
  • Persistent Filters in the Power BI Service

    13 March’ 2018

    Introduction: The feature is finally release, and it is power BI has announced general availability of persistent filt...

    Read more
  • Cause and Solution for Scribe MSMQ not receiving Message from AX

    10 March’ 2018

    Issue: Microsoft Message Queuing (MSMQ) service running on Server might be unable to receive messages. Therefore, messa...

    Read more
  • User Privileges on SharePoint – D365 Document Integration

    10 March’ 2018

    Overview: Often, we wonder what could be wrong where we see a generic error on Documents in Dynamics 365. Something lik...

    Read more