24 April 2021

How to get dataSource in DataSource Fileld COC in D365FO

 [ExtensionOf(formdatafieldstr(EntAssetRequestTableCreate, RequestTable, Object))]

final class TRGEntAssetRequestTableCreateFDF_RT_Object_Extension

{

    public void modified()

    {

        FormDataObject dataObject = any2Object(this) as FormDataObject;

        next modified();

        FormDataSource fds = dataObject.dataSource().formRun().dataSource(formDataSourceStr(EntAssetRequestTableCreate, TRGEntAssetRequestObjectTableView));

        fds.executeQuery();

    }

}

22 April 2021

Events get current record in D365FO

 Formrun formRun                          = sender.formRun();

        FormDataSource datasource                = formRun.dataSource(formDataSourceStr(CustInvoiceTemplate,CustInvoiceTemplate));

        CustInvoiceTemplate custInvoiceTemplate       = datasource.cursor();

21 April 2021

Enable / Disable the dialog field using UIBuilder in Service class / SysOperation fremework

 class TRGIntCalcBorrowingCostUIBuilder extends SysOperationAutomaticUIBuilder

{

    private TRGIntCalcBorrowingCostContract intCalcBorrowCostContract;

    private DialogField dialogPeriodCode;



    /// <summary>

    /// Auguments the UI behavior.

    /// </summary>

    public void postBuild()

    {

        intCalcBorrowCostContract = this.dataContractObject();

        super();

        dialogPeriodCode = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(TRGIntCalcBorrowingCostContract, parmPeriod));

        dialogPeriodCode.enabled(false);

    }


}

09 April 2021

Looping selected records in the form in D365FO and X++ code to loop form selected records.


When the class main method initiated there can pass the args.record to below method and can loop records.

Reference: Class: PurchReqCancel

private void runLoopCancelWin(Common _common)
    {
        FormDataSource fds            = FormDataUtil::getFormDataSource(_common);
        Common         common;

        for (common = fds.getFirst(1) ? fds.getFirst(1) : fds.cursor(); common; common = fds.getNext())
        {
            this.doCancel(common);
        }
    }








Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...