Sunday, 23 March 2014

create new number sequence by x++ code in AX 2012

static void DemoNumberSeq(Args _args)
{
NumberSeq numberSeq;
Str salesId;

numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());
salesId = numberSeq.num();
info(strFmt("%1",salesId));
}

How it works
1.NumberSeq Table act as master table for numberseq code , which stores
format to be generated , next sequence etc.
2.NumberSequenceReferences stores all the references and their corresponding
numberseq codes.
3.As shown in the above code , NumberSeq class needs numberseqreference ,
i,e "EDT. Unique Id for the Process " So first get the references by
passing an EDT as parameter to the findReference method of numberseqreference
class.Than you can call numberSeq.num() method to generate the number
for you.
4.Use NumberSeqFormHandler class if you want to use the numbersequencs on form.

No comments:

Post a Comment