Showing posts with label syssetupformrun. Show all posts
Showing posts with label syssetupformrun. Show all posts

Friday, 11 March 2016

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

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;
}

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

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;
}