Alfasith AX

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

Monday, July 1, 2013

Passing the container value between the forms in Dynamic AX


Over ride as init() method in FormB
public void init()
{
    str             anyStringValueFromCaller;
    container       contain;
    ;
    super();

    // Check for passed arguments
    if( element.args() )
    {
        // get string parameter
        //anyStringValueFromCaller =
        contain = str2con(element.args().parm());
        Sex.text(conPeek(contain,1));
        MaritalStatus.text(conPeek(contain,2));       
        anyStringValueFromCaller = conPeek(contain,3);
        AccountNum.text(anyStringValueFromCaller);
    }
}

Override as clicked() in FormA
void clicked()
{
    // Args class is usually used in Axapta for passing parameters between forms
    Args            args;
    FormRun         formRun;
    container contain;
    str        containstr;
    ;

    args = new args();

    // Our values which we want to pass to FormB
    // If we want pass just simple string we can use 'parm' method of 'Args' class
   contain = [sex.valueStr(),MaritalStatus.valueStr(),AccountNum.valueStr()];
    containstr = con2Str(contain);
    args.parm(containstr);

    // Run FormB

    args.name(formstr(DBForm));
    formRun = classFactory.formRunClass(Args);
    formRun.init();
    formrun.run();
    formrun.wait();

    super();
}



Friday, June 28, 2013

How to pass the parameter from one form to another in Dynamic AX

1.       Create two forms with Name FormA & FormB
2.       FormA with 1 stringedit and 1 button & FormB with 1 StringEdit.
3.       Below code is override in clicked method() of button.
void clicked()
{
    // Args class is usually used in Axapta for passing parameters between forms
    Args            args;
    FormRun         formRun;
    ;
    args = new args();  
    // Our values which we want to pass to FormB
    // If we want pass just simple string we can use 'parm' method of 'Args' class
    args.parm( AccountNum.text() );
    // Run FormB
    args.name( formstr( FormB ) );
    formRun = classFactory.formRunClass( Args );
    formRun.init();
    formrun.run();
    formrun.wait();
    super();
}
4.       Now override init() method in FormB.
public void init()
{
    str             anyStringValueFromCaller;
    ;
    super();
    // Check for passed arguments
    if( element.args() )
    {
        // get string parameter
        anyStringValueFromCaller = element.args().parm();
        SelectedAccountNum.text(anyStringValueFromCaller);
    }
}

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