Saturday, November 21, 2015

How to open the Child form using X++

Error :- Dynamics AX form requires an active buffer

Here is the code for above explanation: -

        Args                    argsForm;
        FormRun             formRun;
        FormRun             subformRun;
        ;
   

        //Open Picking List form
        argsForm = new Args(formstr(ProdJournalTable));
        argsForm.record(ProdJournalTable::find(prodJournalTable.JournalId));
        formRun = classFactory.formRunClass(argsForm);
        formRun.init();
        formRun.run();


        //Now open sub-form (Production Journal Lines)
        argsForm = new Args(formstr(ProdJournalTransBOM));
        //Here you can mention the parent form instance as an active buffer
        argsForm.caller(formRun);    
        argsForm.record(ProdJournalTable::find(prodJournalTable.JournalId));

        subformRun = classFactory.formRunClass(argsForm);
        subformRun.init();
        subformRun.run();
        formRun.close(); //Now close the parent form.
        subformRun.wait(); //This halts your programme execution.

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...