What is Number Sequence ?
Number sequence in Microsoft Dynamics 365 F&O is used to assign a unique number/id to a record so that end user can identify that record later if needed. Number sequence is basically used to generate automatic primary key of any record which is unique and not null. Also it is a one-time setup in number sequence setup form after which system automatically picks the next number sequentially. It is majorly used for purch ID in purchase order, vendor ID in vendor master form, customer ID in customer master form, and many other places.
How to create a Number Sequence ?
Create an EDT for which you want to create the number sequence and set the appropriate properties. Now drag and drop the EDT in the table and add the code as shown below
public class TABLE_NAME extends common
{
public client server static NumberSequenceReference numRefID()
{
return NumberSeqReference::findReference(extendedTypeNum(EDTNAME));
}
}
Now let’s suppose we want to add number sequence in the HRM module, go to the “NumberSeqModuleHRM” class, now in the “loadModule” method at the end of the method write the following code
datatype.parmDatatypeId(extendedTypeNum(EDTNAME));
datatype.parmReferenceHelp(literalStr("Custom Number Sequence Help"));
datatype.parmReferenceLabel(literalstr("Custom Number Sequence Label"));
datatype.parmWizardIsContinuous(false);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::Yes);
datatype.parmWizardIsChangeUpAllowed(NoYes::Yes);
datatype.parmSortField(1);
datatype.parmWizardLowest(1);
datatype.parmWizardHighest(9999);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
Now create a Runnable Class (Job) and run this method, basically you have to load the Number sequence
class TTC_NumberSequenceLoadModule
{
public static void main(Args _args)
{
NumberSeqModuleHRM seqMod = new NumberSeqModuleHRM();
seqMod.load();
}
}
Need help? Connect Atul
- D365 Data entitiy Insert method COC - October 30, 2024
- D365 Joins - October 16, 2024
- D365 Find method and Exist method - October 9, 2024