Working with numbersequences – new NumberSequence
When you want to create a new NumberSequence in AX you have to do the following steps:
1. Create a new Extended Data Type (EDT). Often this EDT extends from num. (this step is not mandatory, but it is a best practice)
2. Discide in witch module this new Number Sequence Reference (classes NumberSeqReference_…) should be included and find the corresponding NumberSeqReference class. (ex. module sales –> NumberSeqReference_SalesOrder)
3. The loadModule() method shows a number of blocks of code, which creates records in the table NumberSequenceReference.
4.Copy a block and change the following fields:
* DataTypeID is the type Id of the new data type.
* referenceLabel is the description shown in the left column of the Number sequence tab on the parameters form.
* referenceHelp is the longer description of the reference shown in the top part of the Number sequence tab of the parameters form.
* sortfield defines the sequence that the references are displayed on the Number sequence tab of the parameters form.
* The wizard fields are default values when using the wizard to create a numbersequenceexample:
1 2 3 4 5 6 7 8 9 | numRef.DataTypeId = typeId2ExtendedTypeId(typeid(NewType)); numRef.ReferenceLabel = literalstr("@..."); numRef.ReferenceHelp = literalstr("@..."); numRef.WizardManual = NoYes::No; numRef.WizardAllowChangeDown = NoYes::No; numRef.WizardAllowChangeUp = NoYes::No; numRef.SortField = #; this.create(numRef); |
5. Create a static method on the parameter table that will be used to retrieve the reference. These methods usually start with “numref”.
example:
1 2 3 4 | static client server NumberSequenceReference numRefNewType() { return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(NewType))); } |
Tags: Data Types, Dynamics AX, Number Sequence, Programming, Tips & Tricks, X++
This entry was posted on Tuesday, May 5th, 2009 at 19:00 and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


February 16th, 2010 at 18:34
Working with numbersequences – New Module | Doens.be says:[...] a previous post I explained how to create a new Number Sequence in a existing module (Working with numbersequences – new NumberSequence). In this post I will explain how you can create a new Number Sequence-module. I will create a new [...]