Showing posts with label Refresh Datasource in class ax 2012. Show all posts
Showing posts with label Refresh Datasource in class ax 2012. Show all posts

Monday, 19 September 2016

Refresh Datasource in class ax 2012

 public void closeOk()
{
    #Task
    FormRun formRun;
    
    super();
    
    // Get an instance of the calling form.
    formRun = element.args().caller();
    
    // If the caller is a form, refresh that form.
    if(formRun)
    {
        formRun.task(#taskF5);
    }
}

Another way 
Class
{
 FormDataSource      formDataSource;
 NoYes      finalizeStatus;

 if (_args == null
    || _args.record().RecId == 0
    || _args.parmEnumType() == 0
    || _args.parmEnumType() != enumNum(FinalizeStatusOCP))
    {
        throw error(Error::wrongUseOfFunction(funcName()));
    }

 formDataSource = _args.record().dataSource();
        finalizeStatus = _args.parmEnum();
 
 formDataSource.research(true);
}