Search This Blog

Tuesday, December 3, 2013

How to stop manual Refresh (F5) on Forms in AX...?

Hi Friends,

By doing a small code change in "SysSetupFormRun" class  we can stop the manual refresh(F5) on any form in AX.

We need to add some code in "task( )" method.

Ex :-

public int task(int _p1)
{
    #task
    FormDataSource formDataSource;
    int ret;
    if (_p1 == #taskFilter)
    {
        formDataSource = this.objectSet();
        if (formDataSource &&
            formDataSource.queryRun() &&
            formDataSource.queryRun().args() &&
            !formDataSource.queryRun().args().caller())
        {
            formDataSource.queryRun().args().caller(this);
        }
    }


   //Custom Code Start>>
  // Stopped manual Refresh on InventTable (Form)
    if ((_p1 == 2876) && // taskF5
        (this.name() == formStr(InventTable )))
    {
        return ret;
    }
   //Custom Code End <<

    ret = super(_p1);
    return ret;
}

Happy Daxing,
Sai.

1 comment:

  1. I think it is better to use the standard Macro instead of the task id as an integer.

    ReplyDelete