Friday, August 22, 2014

To loop though all the form parts in a form in AX 2012

loop though all the form parts in a form in AX 2012

we can call below method from form data source active method:

public void updateLineInfoParts()
{
    PartList    partList;
    int            partListCount;
    FormRun     factBox;
    Object      factBoxObject;

    partList = new PartList(element);

    for (partListCount = 1; partListCount <= partList.partCount(); partListCount++)
    {
        factBox = partList.getPartById(partListCount);
        switch(factBox.name())
        {
            case  formStr("FormPart 1")
                 ,formStr("FormPart 2")
                 ,formStr("FormPart 3"):
                factBoxObject = factBox;
                factBoxObject.methodonFactbox();
                break;
        }
    }
}