Tuesday, October 3, 2017

Number sequence - DAX 365 for Operations

//Number sequence


//For New Module
1. Add a new element in NumberSeqModule (base enum) with your new module name

2. Create a new Class NumberSequenceModuleModuleName extends NumberSequenceModule

3. Override loadModule method by adding the parameters of the sequence

    NumberSeqDatatype datatype = NumberSeqDatatype::construct();

   datatype.parmDatatypeId(extendedtypenum(SSID));
    datatype.parmReferenceHelp(literalstr("SSID"));
    datatype.parmWizardIsManual(NoYes::No);
    datatype.parmWizardIsChangeDownAllowed(NoYes::No);
    datatype.parmWizardIsChangeUpAllowed(NoYes::No);
    datatype.parmSortField(25);

4. Override numberSeqModule method
public NumberSeqModule numberSeqModule()  
   {  
     return NumberSeqModule::NewModule; //NewModule name  
   }  

5. Create new job to load number sequence
static void SSIDNumSeqLoad(Args _args)
   {
      NumberSeqApplicationModule::loadAll();
   }  

6. Go to Organisation Administration ->Common Forms ->Number sequences ->Number Sequences-->Generate and follow the wizard to end to generate number sequence for new module.


//For Existing Module

1. Create a new class similar to NumberSeqModuleVend but suffix it with your module name e.g. NumberSeqModuleMyModuleextended from NumberSeqApplicationModule

2. Added loadModule() method

3. Add numberSeqModule() method with your new added enum value (for your module) in NumberSeqModule_extension (You should create an extension of NumberSeqModule base enum and not customizing it and add new element for your module into that extension)

4. This is an additional step for D365 you would need to perform otherwise it will claim "The value does not exist in the map".

Create a new delegate method to class NumberSeqGlobal which will append the current class to the map that links modules to number sequence data type generators.






[SubscribesTo(classstr(NumberSeqGlobal),delegatestr(NumberSeqGlobal,buildModulesMapDelegate))]  
   static void buildModulesMapSubsciber(Map numberSeqModuleNamesMap)  
   {  
     NumberSeqGlobal::addModuleToMap(classnum(NumberSeqModuleMyModule), numberSeqModuleNamesMap);  
   }  

5. Continue with executing the job to loadAll numberSequences and Generate it from Organization module as mentioned in

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...