Get number sequence code through code in MSD axapta


To Create a new number sequence

Basic>Setup>NumberSequence>NumberSequence

e.g. test_NS with format ######_NS

Now in any form Where the Table e.g. test_NumberSequence is used,
override create method of test_NumberSequence under DataSource Node and do the following

 //1. in class declaration of form  
 public class FormRun extends ObjectRun  
 {  
  numberSeq numberSeq;  
 }  
 //2. in create method of test_NumberSequence  
 public void create(boolean _append = false)  
 {  
   super(_append);  
   numberSeq = NumberSeq::newGetNumFromCode("test_NS", true,true);  
   if (numberSeq)  
   {  
     test_NumberSequence.NS_id = numberSeq.num();  
   }  
 }