Monday, December 24, 2018

Refresh Caller form data source in AX 2012

Refresh Caller form data source:
Parent Form: POCVehicleForm
Child Form: POCInsurenceMaster

Write below code snippet on click method of button on POCVehicleForm

void clicked()
{
    MenuFunction        mf;
    Args                        args;
    ;

    args= new Args();
    args.record(POCVehicle);

    mf=new MenuFunction(identifierStr(POCInsurenceMaster), MenuItemType::Display);
    mf.run(args);
}

Overwrite below method on POCInsurenceMaster:

 public void closeOk()
    {
        #Task
        FormRun formRun;
        super();
        // Buffer of calling form.
        formRun = element.args().caller();
        // Check if caller is form
        if(formRun)
        {
            formRun.task(#taskF5);
        }
    }

Open POCInsurenceMaster from POCVehicleForm and once update record and close child form then parent form will be refreshed.

No comments:

Post a Comment