Sunday, 11 March 2018

How to refresh caller form in Ax 2012

How to refresh caller form in Ax 2012 

The following code refreshes the caller form datasource from the calling form

Code: write below code current form method 


public void close()
{
    FormRun         callerForm;
    ;
    callerForm          = element.args().caller();
    callerForm.dataSource().refresh();
    callerForm.dataSource().reread();
    callerForm.dataSource().research();
    super();
}

or
void clicked()


{
    Args    arg = new Args();
    FormRun formRun;    
    ;
    arg = new args(formstr(YourForm));
    arg.record(yourTable);
    arg.caller(this);
    formRun = classFactory.formRunClass(arg);
    formRun.init();
    formRun.run();
    formRun.wait();
    formRun.detach();
    
    YourTable_DS.reread();
    YourTable_DS.rereadReferenceDataSources();
    YourTable_DS.research(true);
}
1. reread() – Rereads the current record from the database
2. rereadReferenceDataSources() – Rereads the reference records of the current record from the database
3. research(true) – true parameter retains the current position of the dataSource cursor after researching

No comments:

Post a Comment

Step-by-Step Guide to Restore a SQL BACPAC File - Microsoft dynamics D365 Fin & Ops

 Restore steps for bacpac file in to SQL server - Microsoft dynamics D365 Fin & Ops. Log in to LCS and navigate to the asset library. On...