Tuesday, September 28, 2021

Sequence of methods in form and table

Sequence of methods in form and table in D365 FO


Form:

Sequence of Methods calls while opening the Form

Form — init ()

Form — Datasource — init ()

Form — run ()

Form — Datasource — execute Query ()

Form — Datasource — active ()


Sequence of Methods calls while closing the Form

Form — canClose ()

Form — close ()


Sequence of Methods calls while creating the record in the Form

Form — Datasource — create ()

Form — Datasource — initValue ()

Table — initValue ()

Form — Datasource — active ()


Sequence of Method calls while saving the record in the Form

Form — Datasource — ValidateWrite ()

Table — ValidateWrite ()

Form — Datasource — write ()

Table — insert ()


Sequence of Method calls while deleting the record in the Form

Form — Datasource — validatedelete ()

Table — validatedelete ()

Table — delete ()

Form — Datasource — active ()


Sequence of Methods calls while modifying the fields in the Form

Table — validateField ()

Table — modifiedField ()




Table:

When you press CTR+N

initValue()->


When you change data in a field

validateField() -> validateFieldValue() -> ModifiedField() -> ModifiedFieldValue()


When you close the table after entering some data

validateWrite() – > Insert() -> aosValidateInsert()


When you Save the Record for the first time

validateWrite() ->Insert() – > aosValidateInsert()


When you modify the record and saving

validateWrite() -> update() – > aosValidateUpdate()


When you delete the record

validateDelete() -> delete() -> aosValidateDelete()

Monday, September 27, 2021

SSMS commands

 To see all he processes in ssms

SP_who2


To kill a process by procesId

kill 52

Thursday, September 16, 2021

How to customise standard report in D365 FO

 Find the menu item, in my case I am taking "TaxTrans"

Create extension for same

go to the class on the menu item and create extension of same class, in my case my class was "TaxTransController"

I created a new extension class of controller class


class GITS_TaxTransControllerExt extends SrsReportRunController

{

    public static client void main(Args _args)

    {

        GITS_TaxTransControllerExt Controller;

        Controller = new GITS_TaxTransControllerExt();

        Controller.parmArgs(_args);

        Controller.parmReportName(ssrsReportStr(GITS_TaxTrans,Report));

        Controller.parmShowDialog(true);

        Controller.startOperation();

    }

}



Now dublicate the report in your project area and look for dp class

Now create a new extension class "GITS_TaxTransDP_Extension" for the DP class, in my case dp class was "TaxTransDP"

Also create extension of temp table and add the required fields

Write the following code and update logic accordingly


[ExtensionOf(classstr(TaxTransDP))]

final class GITS_TaxTransDP_Extension

{

    [PostHandlerFor(classStr(TaxTransDP), methodStr(TaxTransDP, processReport))]

    public static void TaxTransDP_Post_processReport(XppPrePostArgs args)

    {

        TaxTrans    lclTaxTrans;       

        TaxTransDP dpInstance = args.getThis() as TaxTransDP;

        TmpTaxTransReport lclTmpTaxTransReport = dpInstance.getTaxTransTmp();

        ttsbegin;

        while select forupdate lclTmpTaxTransReport

        {

            select sum(TaxBaseAmount) from lclTaxTrans

                where lclTaxTrans.Voucher   == lclTmpTaxTransReport.Voucher;

            lclTmpTaxTransReport.TaxBaseAmount  = lclTaxTrans.TaxBaseAmount;

            lclTmpTaxTransReport.update();

        }

        ttscommit;

    }

}



Now Build and deploy

Tada !!!