Showing posts with label newgetnumfromcode. Show all posts
Showing posts with label newgetnumfromcode. 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);