Skip to main content

Number sequence with existing module and new module

Number sequence customization in Dynamics 365

Create a number sequence in a standard module

Step 1: Create new EDT

Step 2: Add a new code block to the loadModule in the NumberSeqModuleXXX class

Step 3: Add a new static method to the parameters table of the module to get the number sequence reference

Using Extension

[ExtensionOf(classStr(NumberSeqModuleCustomer))] final class NumberSeqModuleCustTest_Extension
{
protected void loadModule()
{
NumberSeqDatatype datatype = NumberSeqDatatype::construct();
next loadModule();
datatype.parmDatatypeId(extendedTypeNum(TestId));
datatype.parmReferenceHelp(literalStr(‘Test ID’));
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);
}
}

[ExtensionOf(tableStr(CustParameters))] final class CustParametersTest_Extension
{
client server static NumberSequenceReference numRefTestId()
{
return NumberSeqReference::findReference(extendedTypeNum(TestId));
}
}

Create a number sequence in a new module

Step 1: Add a new element to the NumberSeqModule base enum.

Step 2: Create a NumberSeqModule* class for our module.

Step 3: To add a new element to the NumberSeqModule Base Enum we can use an extension.

Step 4: Now we need to create a new class extends with NumberSeqApplicationModule
class NumberSeqModuleTest extends NumberSeqApplicationModule
{
protected void loadModule()
{
NumberSeqDatatype datatype = NumberSeqDatatype::construct();
datatype.parmDatatypeId(extendedTypeNum(TestId));
datatype.parmReferenceHelp(literalStr(‘Test ID’));
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);
}

public NumberSeqModule numberSeqModule()
{
return NumberSeqModule::Test;
}

[SubscribesTo(classstr(NumberSeqGlobal),delegatestr(NumberSeqGlobal, buildModulesMapDelegate))]
static void buildModulesMapSubsciber(Map numberSeqModuleNamesMap)
{
NumberSeqGlobal::addModuleToMap(classnum(NumberSeqModuleTest), numberSeqModuleNamesMap);
}
}
Job: (To load all module number sequences)
static void Test_NumSeqLoad(Args _args)
   {
      NumberSeqApplicationModule::loadAll();
   }

Comments

Popular posts from this blog

[D365/AX7] How to: Create and Use number sequence

[D365/AX7] How to: Create number sequence Posted on January 7, 2018 Updated on January 11, 2018 Number sequences are used to generate readable, unique identifiers for master data records and transaction records that require identifiers. A master data record or transaction record that requires an identifier is referred to as a reference. On this example, we are going to create a new number sequence for customer group. Create a new class that extends the NumberSeqModuleCustomer class and then create the method loadModule_Extension and add the following code: class NumberSeqModuleCustomer_CFS extends NumberSeqModuleCustomer {         public void loadModule_Extension()         {                 NumberSeqDatatype datatype = NumberSeqDatatype::construct();          ...

Batch Multi threading D365FO AX7

Batch Multi threading D365FO AX7 Normally, when we schedule our RunBaseBatch class as a batch job, it will create single task. Which will responsible to execute complete process in single thread. But, As you know like AX-2009 and AX-2012. In D365FO We can add multiple AOS server in single batch group and they can process the multiple task simultaneously.  In this demo I will show, How to create multi threading Batch job. following are the steps Step-1 Create a table for demo purpose in our demo we keep table name is  SLD_DemoTable . Step-2 create a class with name  SLD_DemoBusinessLogic  and write your business logic in this class. In demo I write only insert records in table and show you guys how it works. Reference Code class   SLD_DemoBusinessLogic {      public   void  processInit( VendTable  _vend)     {          SLD_DemoTable  ...