To use number sequence based on the condition selected in Ax 2012

  After Creating The Number sequence we need to use based on the condition....like if u selected the year 2020 then number sequence start with the series 2020-###

    and if u select 2021 number sequence starts with series 2021-###.

For that we have to create two number sequences amd use them based on our condition like below code.

public void initValue()

{

    NumberSeq                numberSeq1,numberSeq2;

    DAXTestingMain                   dAXTestingLoc;

    super();

    dAXTestingLoc           = element.args().record();//using args to get the year from caller form


    if(dAXTestingLoc.DaxYear=='2021' && dAXTestingLoc.Action==NoYes::Yes)

    {


        numberSeq1 = NumberSeq::newGetNum(NumberSeqReference::findReference(extendedTypeNum(DaxYear)));

        DAXTesting.DaxYear=numberSeq1.num();

        DAXTesting.insert();

    }

    else if(dAXTestingLoc.DaxYear=='2020'&& dAXTestingLoc.Action==NoYes::Yes)

        {

            numberSeq2 = NumberSeq::newGetNum(NumberSeqReference::findReference(extendedTypeNum(NewYear)));

            DAXTesting.NewYear=numberSeq2.num();

            DAXTesting.insert();

        }


}

No comments:

Post a Comment