Sunday, September 30, 2012

Step to Add new Number Sequence



Here is the simplest steps  to create new number sequence

Steps :

1- Add this code in loadModule() method  on proper number sequence class  , every dynamics ax module has its own number sequence class , here I use Sales and Marketing module  and the class is NumberSeqModuleCRM


     /* Setup Analysis Id numbers sequence   */
    datatype.parmDatatypeId(extendedtypenum(AnalysisId));
    datatype.parmConfigurationKeyId(configurationkeynum(SmmCRM));
    datatype.parmReferenceHelp(literalstr("Shabakah  analysis Requirement reference"));
    datatype.parmWizardIsContinuous(true);
    datatype.parmWizardIsManual(NoYes::No);
    datatype.parmWizardIsChangeDownAllowed(NoYes::No);
    datatype.parmWizardIsChangeUpAllowed(NoYes::No);
    datatype.parmSortField(4);
    datatype.parmWizardHighest(999999);

    datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
    this.create(datatype);



2 - In class declration of Form

 NumberSeqFormHandler numberSeqFormHandler;



3- create new method in form level

NumberSeqFormHandler numberSeqFormHandler()
{

if (!numberSeqFormHandler)
{

numberSeqFormHandler = NumberSeqFormHandler::newForm(NumberSeqReference::findReference(extendedTypeNum(AnalysisId)).NumberSequenceId,
element,
Analysis_ds,
fieldNum(Analysis, AnalysisId));

}

return numberSeqFormHandler;
}



4- Add this code after super()  in datasource create()  method


element.numberSeqFormHandler().formMethodDataSourceCreate();



5 -  Run this code  in job

    NumberSeqModuleCRM   crm = new NumberSeqModuleCRM();
    crm.load();



6- Make Generate number sequence from Organization Administration



No comments:

Post a Comment