21 August 2020

how to print report for selected Record in D365FO & Running an SSRS report from the selected record D365 F&O

Running an SSRS report from the selected record

class TRGVendAccuredPurchaseController extends SrsReportRunController

{

    public static void Main(Args _args)

    {

        TRGVendAccuredPurchaseController::construct(_args).startOperation();

    }


    public static TRGVendAccuredPurchaseController construct(Args _args)

    {

        TRGVendAccuredPurchaseController controller = new TRGVendAccuredPurchaseController();

        controller.parmReportName(ssrsReportStr(TRGVendAccruedPurchases, Report));

        controller.parmArgs(_args);

        controller.parmLoadFromSysLastValue(false);

        return controller;

    }


    public void prePromptModifyContract()

    {

        FormRun formRun = this.parmArgs().caller();        

        ProjTable projtable = this.parmArgs().record();


        if((formRun) && (formRun.name() == Formstr(ProjTable) || formRun.name() == Formstr(ProjProjectsListPage)))

        {

            SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(PurchTable),fieldNum(PurchTable, ProjId),SysQuery::value(projtable.ProjId));

        }

        super();

    }


}

Working with the calling object of a formcaller in d365FO

 FormRun formRun = this.parmArgs().caller();        

 ProjTable projtable = this.parmArgs().record();


        if((formRun) && (formRun.name() == Formstr(ProjTable) || formRun.name() == Formstr(ProjProjectsListPage)))

        {

            SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(PurchTable),fieldNum(PurchTable, ProjId),SysQuery::value(projtable.ProjId));

        }

03 August 2020

How to get multiple record or selected record in D365FO

Public static void main(Args _args)
{
ProjOnAccTrans  projOnAccTrans;
        FormRun formRun = _args.caller();
        FormDataSource fds;
        fds = formRun.dataSource(formDataSourceStr(ProjTransOnAcc,ProjOnAccTrans));

        projOnAccTrans = fds.getFirst(true);
}

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-...