Number sequence issue Ax 2012?

I have created a New number sequence named ‘MyNumberSeq’ using Number sequence form under Organization administration Module in AX 2012. Now, I am using this number sequence in a form in some static field let’s say ‘MyNumberseqField’ in Form ‘MyForm’ that will save the record in a table after pressing save button. If I am creating a new record, it is getting the number sequence in a specified field and data gets saved if I press Save button. I am fetching number sequence as

MyNumberseqField.text(numberSeq::newGetNumFromCode("MyNumberSeq").num());

But My issue arises when I am closing this form by pressing cancel or by pressing Esc button(Let’s say Number seq generated is MD-00001). Logically Number sequence which was generated should get free on this action. The form closes as any normal form, Now if am opening this form again to create new record, New number seq (MD-00002) gets generated instead of previous unused number MD-00001. Please suggest any solution for this or any other alternate way to create Number seq.

Similar issue, http://dynamicsuser.net/forums/p/64881/342780.aspx#342780

Hi ,

In continous number sequence the number 001 stays Active in NumberSequenceList table until we run the cleanup job. In Ax2012, We can cleanup by first closing the Ax client and then after opening Ax again. Run the clean up job from the path (Module(AP/AR,etc)\Setup\Parameters\Number Sequences\Navigate to original number sequence and Click on Manual Clean up button\Current).

Once you clean up the number 001 , it will be available to be used.

Regards,

Sushanth