Event for Table in D365 F&O

Rumman Ansari   Software Engineer   2023-10-27   1169 Share
☰ Table of Contents

Table of Content:


Event Handler for Table


[DataEventHandler(tableStr(SalesTable), DataEventType::Inserting)]

public static void SalesTable_onInserting(Common sender, DataEventArgs e)
    {

        SalesTable salesTableObj = sender as SalesTable;
        SalesAgreementHeader                salesAgreement;
        AgreementHeaderDefault              agreementHeaderDefault;
        SalesAgreementHeaderDefault         SalesAgreementHeaderDefault;
        str                                 tmpVal; 

        TM_CustomDocumentListParms docList = TM_CustomDocumentListParms::find(TM_DocsCustom::SalesConfirmation, salesTableObj.TaxGroup);


        if(docList && docList.TermsAndConditions && docList.TermsAndConditions != "" &&
            salesTableObj.SalesId && salesTableObj.SalesId != "" && salesTableObj.TM_TermsAndConditions == "")
        {
            salesTableObj.TM_TermsAndConditions = docList.TermsAndConditions;
        }
    } 

Event Handler for Table in D365 F&O

Event Handler for Table in D365 F&O
Figure: Event Handler for Table in D365 F&O


/// <summary>
/// 
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[DataEventHandler(tableStr(CustTable), DataEventType::Deleted)]
public static void CustTable_onDeleted(Common sender, DataEventArgs e)
{       
}



Event Handler for Table - Pre and Post Event Handler in D365 F&O

Event Handler for Table - Pre and Post Event Handler in D365 F&O
Figure: Event Handler for Table - Pre and Post Event Handler in D365 F&O

Pre Handler

/// <summary>
/// 
/// </summary>
/// <param name="args"></param>
[PreHandlerFor(tableStr(CustTable), tableMethodStr(CustTable, balanceMST))]
public static void CustTable_Pre_balanceMST(XppPrePostArgs args)
{       
}

Post Handler

/// <summary>
/// 
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(tableStr(CustTable), tableMethodStr(CustTable, balanceMST))]
public static void CustTable_Post_balanceMST(XppPrePostArgs args)
{       
}