- Create the data type.
- Add code in the loadModule method of the appropriate NumberSeqModule subclass.
- Add a method to the module’s parameters table that returns a reference to the number sequence.
To create the number sequence, we need to extend the loadModule method of the appropriate NumberSeqModule subclass. For example, if we wish to add the number sequence to Accounts Receivable, we will use NumberSeqModuleCustomer. Using chain of command, we extend this class with a new class like the following.
[ExtensionOf(classStr(NumberSeqModuleCustomer))]
final class NumberSeqModuleCustomer_Extension
{
protected void loadModule()
{
next loadModule();
NumberSeqDatatype datatype = NumberSeqDatatype::construct();
datatype.parmDatatypeId(extendedTypeNum(CustomerChargesID));
datatype.parmReferenceHelp("Cusromer Charges NumSeq");
datatype.parmWizardIsContinuous(false);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
datatype.parmSortField(151);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
}
}
The last step is to add a method that returns a reference to the number sequence. The best practice is to put the method on the module’s parameters table. Like the NumberSeqModule class, we need to extend the table’s class. This code should look like the following.
[ExtensionOf(tableStr(CustParameters))]
final class ARDCustparameters_Extension
{
public static NumberSequenceReference numRefCustomerChargesID()
{
return NumberSeqReference::findReference(extendedTypeNum(CustomerChargesID));
}
}
Like the NumberSeqModule subclass, the name of the class needs to end with “Extension” and to use the ExtensionOf attribute (be careful to not use classStr instead of tableStr ). There does not need to be a next statement as this is a new method.
class GenerateCustChargeIDNumberSequence
{
public static void main(Args _args)
{
NumberSeqModuleCustomer module = new NumberSeqModuleCustomer();
module.load();
info('Number Sequence Loaded');
}
}