Number sequence for existing module and for new module
Create a number sequence in a standard(existing) module D365 style
1) Create new EDT
2) Add a new code block to the loadModule in the NumberSeqModuleXXX class
3) Add a new static method to the parameters table of the module to get the number sequence reference
Using Extension
[ExtensionOf(classStr(NumberSeqModuleBank))]
final class ILNumberSeqModuleBank_Extension
{
protected void loadModule()
{
NumberSeqDatatype datatype = NumberSeqDatatype::construct();
next loadModule(); // Execute the augmented original class method
datatype.parmDatatypeId(extendedTypeNum(ILAutoPaymReference));
datatype.parmReferenceHelp(literalStr('@GIL:AutoPaymentReference'));
datatype.parmWizardIsContinuous(false);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmSortField(1);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
}
}
Create a number sequence in a new module
1) Add a new element to the NumberSeqModule base enum.
2) Create a NumberSeqModule class for our module.
3) To add a new element to the NumberSeqModule Base Enum we can use an extension.
4) Now we need to create a new class extends with NumberSeqApplicationModule
public class ILNumberSeqModuleMyNewSeq extends NumberSeqApplicationModule
{
public void initializeReference(NumberSequenceReference _reference,
NumberSeqDatatype _datatype, NumberSeqScope _scope)
{
super(_reference, _datatype, _scope);
}
protected void loadModule()
{
NumberSeqDatatype datatype = NumberSeqDatatype::construct();
datatype.parmDatatypeId(extendedtypenum(MyNewSeq));
datatype.parmReferenceHelp(literalstr("@GIL:MyNewSeq"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmIsGroupEnabled(NoYes::Yes);
datatype.parmSortField(119);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
}
public NumberSeqModule numberSeqModule()
{
return NumberSeqModule::MyNewModule;
}
[SubscribesTo(classstr(NumberSeqGlobal),delegatestr(NumberSeqGlobal,buildModulesMapDelegate))]
static void buildModulesMapSubsciber(Map numberSeqModuleNamesMap)
{
NumberSeqGlobal::addModuleToMap(classnum(ILNumberSeqModuleMyNewSeq), numberSeqModuleNamesMap);
}
}
Comments
Post a Comment