Oct 20, 2023

How to get the report name in RDP class

 

[ExtensionOf(classStr(AssetBalancesDP))]

final class AssetBalancesDP_AHCJH_Fin_Extension

{


    public void processReport()

    {

        SrsReportName rptName;        

        next processReport();

        AssetBalancesTmp assetBalancessTmp = this.getAssetBalancesTmp();

        AssetTable                 assetTable;      

       

        Dynamics.AX.Application.SysDocuBrandContract docubrand = this.docuBrandContract;

        rptName = docubrand.parmReportName();

        if(rptName == "MyReport_AssetBalances")

        {        

            update_recordset assetBalancessTmp

                setting                  

                    AdditionalName = assetTable.AdditionalName

                join assetTable

                    where assetTable.AssetId == assetBalancessTmp.AssetId;

        }    

    }

}

Oct 19, 2023

How to update a temp table column in D365 FO

 [ExtensionOf(classStr(AssetRollForwardDP))]

final class AssetRollForwardDP_My_Extension

{

 //  Overriding getAssetRollForwardTmp() as it is returning the temp table buffer.

 public AssetRollForwardTmp getAssetRollForwardTmp(AssetRollForwardContract _contract, Query _query)

    {

        AssetRollForwardTmp assetRollForwardTmpUpd;        

        AssetTable      assetTableBuf;         

        next  getAssetRollForwardTmp(_contract, _query);   

        assetRollForwardTmpUpd.linkPhysicalTableInstance(assetRollForwardTmp);

               

        update_recordset assetRollForwardTmpUpd

            setting 

                AssetName = assetTableBuf.AdditionalName

            join AdditionalName from assetTableBuf

            where assetRollForwardTmpUpd.assetid == assetTableBuf.AssetId;


        return assetRollForwardTmp;

    }


}

How to use From Datasource Level Record Writing Event In D365 FO

 


Public class My_LedgerJourTransAssetFrm_EventHandler

{  

     /// <summary>

    ///

    /// </summary>

    /// <param name="sender"></param>

    /// <param name="e"></param>

    [FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransAsset, LedgerJournalTrans_Asset), FormDataSourceEventType::Writing)]

    public static void LedgerJournalTrans_Asset_OnWriting(FormDataSource sender, FormDataSourceEventArgs e)

    {

        LedgerJournalTrans_Asset       LedgerJourTransAssetTableLoc = sender.cursor();

        LedgerJourTransAssetTableLoc.AdditionalName = AssetTable::find(LedgerJourTransAssetTableLoc.Assetid).AdditionalName;

    }


}