Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Thursday, June 27, 2013

Sequence of Form's Methods in Dynamics AX

This gives the information of method calls in the form level while
1. Opening the Form.
2. Creating/Updating/Deleting the record in the Form.
3. Closing the 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 ()

Macros in Dynamics AX X++


A macro is a variable known to the precompiler. The variable can have a value that is a sequence of characters, but it is not required to have a value. The #define directive tells the precompiler to create the macro variable, including an optional value. The #if directive tests whether the variable is defined, and optionally, whether it has a specific value.
The value of a macro variable can be written into the X++ code at any location, by giving the name of the macro with the # character added as a prefix.
All precompiler directives and symbols begin with the # character. All of the directives and symbols are handled and removed before the resulting X++ code is given to the X++ compiler.

Simple Macro example of defining  
static void SimpleDefineIfJob(Args _args)
{
    str sTest = "Initial value.";
    ;
    #define.MyMacro // MyMacro is now defined.

    #if.MyMacro
        sTest = "Yes, MyMacro is defined.";
        info(sTest);
    #endif

    // Notice the non-code sentence line causes no X++ compiler error,
    // because the X++ compiler never sees it.
    #ifnot.MyMacro
        The X++ compiler would reject this sentence.
        sTest = "No, MyMacro is not defined.";
        info(sTest);
    #endif

/********** Actual output
Message (03:46:20 pm)
Yes, MyMacro is defined.
**********/

}

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...