preloader-matrix

Alfasith

Number Sequence in Dynamic AX (for Form level)

1. Create EDT
2. Use that EDT in the Tablewhere it is required
3. Select the Classmodule which you going to implement this Number seq.
//Consider if we want for HRM then “NumberSeqModuleHRM” class is the target.
//Add below code in the loadModule()
            protected void loadModule()
     {
     NumberSeqDatatype datatype = NumberSeqDatatype::construct();
//Added by Alfasith
     datatype.parmDatatypeId(extendedtypenum(customerID));
//your EDT
     datatype.parmReferenceLabel(literalstr(“RES-customerID”));
//Your label
     datatype.parmReferenceHelp(literalstr(“RES-customerID”));
     datatype.parmWizardIsContinuous(true);
     datatype.parmWizardIsManual(NoYes::No);
     datatype.parmWizardIsChangeDownAllowed(NoYes::No);
     datatype.parmWizardIsChangeUpAllowed(NoYes::No);
     datatype.parmWizardLowest(1);
     datatype.parmWizardHighest(99999999);
     datatype.parmSortField(15);
//(This 15 is the next number that already in that default list)
     datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
    this.create(datatype);
    //code end
     }
4. Select the concern table. Create new methods as below
Here we take HRMParameters table 
// table on which that number seq is going to generate.
static clientserver NumberSequenceReference customer()
{
    return NumberSeqReference::findReference(extendedtypenum(customerID));//Your EDT name
}
5. Create a new job with the following code and run it:
static void NumberSeqLoadAll(Args _args)
{
NumberSeqApplicationModule::loadAll();
}
6. ( Control + W )
Select Organization administration-> Number Sequence-> Number Sequence
Select the module //here we select Human Resources
Select the EDT you created //Surly that EDT you created will be appear here.
Click GENERATE
7. Create a new job with the following code and run it:
static voidNetvendNumberSeq(Args _args)
{
    NumberSeq  numberSeq;
    StudentID num;
    ;
    numberSeq = NumberSeq::newGetNum(VendParameters::student());
   
    num = numberSeq.num();
    info(num);
}
8. Select the Form on which that table is required.
Drop the table in to that form Data Source.
8(a). ClassDeclaration. Write the below code.
public classFormRun extends ObjectRun
{
    NumberSeqFormHandler numberSeqFormHandler;
}
/*************************************************************/
8(b). Create new method
NumberSeqFormHandler numberSeqFormHandler()
{
    if (!numberSeqFormHandler)
    {
       numberSeqFormHandler = NumberSeqFormHandler::newForm(NetRMSParameters::customer().NumberSequenceId,
                                                             element,
                                                             Table2_ds,
                                                             fieldNum(Table2, customerID)
                                                            );
    }
    return numberSeqFormHandler;
}
/***********************************************************/
8(c). Override the datasource methods of that table with following method in that form.
public voiddelete()
{
    ;
    element.numberSeqFormHandler().formMethodDataSourceDelete();
     super();
}
/***********************************************************/
public voidwrite()
{
    super();
    element.numberSeqFormHandler().formMethodDataSourceWrite();
}
/***********************************************************/
public voidcreate(boolean _append = false)
{
    ;
    super(_append);
    element.numberSeqFormHandler().formMethodDataSourceCreate();
}

/***********************************************************/
Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

One Response

Leave a Reply

Your email address will not be published.