Creating Number Sequence In Microsoft D365 F&O Through X++

EDT Created For Number Sequence
Fig 1
[ExtensionOf(classStr(NumberSeqModuleVendor))]final class NumberSeqBill_Extension{ protected void loadModule() {  next loadModule();  NumberSeqDatatype datatype = NumberSeqDatatype::construct();  datatype.parmDatatypeId(extendedTypeNum(SLD_BillID_EDT));  datatype.parmReferenceHelp(literalStr("@Example:ExampleIdHelp"));  datatype.parmWizardIsContinuous(false);  datatype.parmWizardIsManual(NoYes::No);  datatype.parmWizardFetchAheadQty(10);  datatype.parmWizardIsChangeDownAllowed(NoYes::No);  datatype.parmWizardIsChangeUpAllowed(NoYes::No);  datatype.parmWizardHighest(999999);  datatype.parmSortField(1000);  datatype.addParameterType(NumberSeqParameterType::DataArea, true,     false);  this.create(datatype); }}
[ExtensionOf(tableStr(VendParameters))]final class SLD_BillTable_Extension{ public static NumberSequenceReference numRefID() { return    NumberSeqReference::findReference(extendedTypeNum(SLD_BillID_EDT)); }}
[Form]public class SLD_Bill_Form extends FormRun{[DataSource]class SLD_Bill{  public void initValue()  {   super();   NumberSeq numSeq;   SLD_BillID_EDT billID;   ttsbegin;   numSeq = NumberSeq::newGetNum(VendParameters::numRefID());   billID = numSeq.num();   ttscommit;   SLD_Bill.BillID=billID;  } }}
class SLD_Runnable{public static void main(Args _args){NumberSeqModuleVendor module = new NumberSeqModuleVendor();module.load();info('finished');}}
Generate Number Sequence
Fig 2
Number Sequence Properties
Fig 3
  • Manual (user can give the value on its own too while creating a new record, instead of auto-generation)
  • Continuous (every time a new value will be generated regardless of the fact that if previous records are deleted, and previous numbers are also available to be allotted)
  • Pre Allocation (Instead of hitting the db every time to fetch a new sequence, it allocates the values within the given range and uses it as per the need)
  • Lowest Number
  • Highest Number
Pre Allocation Property
Fig 4

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store