Search This Blog

Wednesday, 2 April 2014

Create number sequence record through code including format in Ax 2012

Hi Guys,

Today i would like to share you , how to create a number sequence record through code including format .

Write this below code in a job and execute , 

NumberSequenceTable   numberSeqTable;
NumberSequenceScope  numberSeqScope;
container                         segments;
str                                   annotatedFormat, format;
;

select  numberSeqScope
       where numberSeqScope.DataArea = = 'LOC';

segments += [[0, 'LOC']];
segments += [[-1,'-']];
segments += [[-2,'######']];

annotatedFormat  = NumberSeq::createAnnotatedFormatFromSegments(segments);
format                  = NumberSeq::createAnnotatedFormatFromSegments(segments, false);

numberSeqTable.clear();
numberSeqTable.NumberSequence           = 'PROJ';
numberSeqTable.Txt                                 = 'Test';
numberSeqTable.AnnotatedFormat           = annotatedFormat;
numberSeqTable.NumberSequenceScope = numberSeqScope.RecId;
numberSeqTable.Format                           = format;
numberSeqTable.Highest                           = 999999;
numberSeqTable.Lowest                           = 1;
numberSeqTable.NextRec                         = 1;
numberSeqTable.insert();
 
Thanks & Regards, 
Banupriya.S

No comments:

Post a Comment