Showing posts with label number. Show all posts
Showing posts with label number. Show all posts

Tuesday, December 1, 2015

Manually generate Number Sequence & release unused

The below code is to manually generate the number from the Number Sequence code:

numberSeq = NumberSeq::newGetNumFromCode(BankAccountTable::findByLedgerDimension(this.OffsetLedgerDimension).FundsTransferRefNum);

Sometimes we face this situation where number sequence doesn't release the unused numbers even if the Number sequence is configured as "Continuous". In that case we can use the below code:

NumberSeq::releaseNumber(NumberSequenceTable::findByNaturalKey(BankAccountTable::findByLedgerDimension(this.OffsetLedgerDimension).FundsTransferRefNum).RecId, ledgerJournalTrans_FundsTransfer.FundsTransferRefNum);

Wednesday, September 9, 2015

Ax2012 Number Sequence with year

Source:

http://dev.goshoom.net/en/2013/10/year-in-number-sequence/

Reset Number sequence Ax2012

Whenever you need to reset the number sequence in AX2012 you can use the below job code. You just need to pass the company name for which you want to reset.

static void resetNumSeq(Args _args)
{
    NumberSequenceTable numseqtab;
    info(curext());
    changecompany ('test')
    {
        ttsbegin;
        while select forupdate numseqtab
        {
            numseqtab.NextRec = numseqtab.Lowest;
            numseqtab.update();
        }
        ttscommit;
    }
}