Wednesday, May 21, 2014

Resolving Ctrl+F5 Error on creation of Item Master while edit and update in Master data in AX2012:

Resolving Ctrl+F5  Error on creation of Item Master while edit and update in Master data in AX2012:

 FormRun         formRun;
    FormObjectSet   formObjSet;
    int             i;
    InventTable     linventTable;

    // refresh and reread inventTable datasource if exists in form
    if (this.isFormDataSource())
    {
        formRun = this.dataSource().formRun();
        for (i=1; i<= formRun.dataSourceCount(); i++)
        {
            if (formRun.dataSource(i).cursor() is InventTable)
            {
                formObjSet = formRun.dataSource(i);
                linventTable = formObjSet.cursor() as InventTable;
                break;
            }
        }
        if (!linventTable)
        {
            linventTable = InventTable::find(this.ItemId, true);
        }
        if (linventTable)
        {
            if (formObjSet)
            {
                formObjSet.refresh();
                formObjSet.reread();
            }
        }
    }

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...