Skip to main content

Steps for Number Sequence Creation

Simple Steps To Create Number Sequence In Ax2012

          
Creating number seq:



We Have to take a EDT name as "Loan Id" and create in number sequence.For that first we should select a module for new number sequence for example Human resourse module.
                                    steps:

1.  Create an edt : LoanId .

     AOT >> Extended Data Types >> New  >> Properties >> Name  >> Loan Id.

2. Write a code on lode module() on NumberSeqModuleProject

{     datatype.parmDatatypeId(extendedTypeNum(Loan Id));
     datatype.parmReferenceHelp(literalStr("@Lev853483"));
     datatype.parmWizardIsManual(NoYes::No);
     datatype.parmWizardIsChangeDownAllowed(NoYes::No);
     datatype.parmWizardIsChangeUpAllowed(NoYes::No);
     datatype.parmWizardHighest(999999);
     datatype.parmSortField(20);
     datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
     this.create(datatype);
}

3.Write a method on HRMparameters Table

     client server static NumberSequenceReference numRefLoanId()
{
     return NumberSeqReference::findReference(extendedTypeNum(Loan Id));
}

4.Write a job and run that

static void LoanId(Args _args)
{
    NumberSeqModuleProject  NumberSeqModuleProject = new NumberSeqModuleProject();
    ;
    NumberSeqModuleProject.load();
}


5. Then run the wizard

   Organization Administration >> CommonForms >> Numbersequences>>Numbersequences>> Generate >> run the wizard.

6.Now we have to check the number sequence  is correctly working  for that write a job:

static void numseqLondid(Args _args)
{
    NumberSeq  numberSeq;
    CarId num;
    ;
    numberSeq = NumberSeq::newGetNum(ProjParameters::numRefcarId());
    num = numberSeq.num();
    info(num);
}

  Run the above job.We will find the generated Number     sequence.                                                    .

7. Now we want that Number Sequence in form level(Loan Request):

Declare the number sequence On Form Declaration:

public class FormRun extends ObjectRun
{
    NumberSeqFormHandler numberSeqFormHandler;

}

 8. Write the NumberSeqFormHandler() in form methods node.

NumberSeqFormHandler numberSeqFormHandler()
{
    if (!numberSeqFormHandler)
    {
        numberSeqFormHandler = NumberSeqFormHandler::newForm(HRMParameter::numRefLoanId       ().NumberSequenceId,
                                                             element,
                                                             LoanRequest_DS,
                                                             fieldNum(LoanRequest, LoanId)
                                                            );
    }
    return numberSeqFormHandler;
}


9.Write the close() on the form methods node.

void close()
{
    if (numberSeqFormHandler)
    {
        numberSeqFormHandler.formMethodClose();
    }
    super();
}

10. Then final add the below methods on data source methods node
Create()

void create(boolean append = false,
            boolean extern = false)  // If created externally
{
    element.numberSeqFormHandler().formMethodDataSourceCreatePre();

    super(append);

    if (!extern)
    {
        element.numberSeqFormHandler().formMethodDataSourceCreate(true);
    }
}

Delete()

public void delete()
{
    element.numberSeqFormHandler().formMethodDataSourceDelete();
    super();
}

Write()

public void write()
{
    super();
    element.numberSeqFormHandler().formMethodDataSourceWrite();
}

Validate Write()

public boolean validateWrite()
{
    boolean         ret;
    ret = super();
    ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;
    if (ret)
    {
        Loanrequest.validateWrite();
    }
    return ret;
}

Link Active()

public void linkActive()
{
    ;
    element.numberSeqFormHandler().formMethodDataSourceLinkActive();
    super();
}

 Now our numberseqence is generated .

Comments

Popular posts from this blog

Form Auto refresh in D365 fo

Here I will explain one of the requirements I came across to refresh from automatically without User interaction.  Note: Make sure we do have all the handlers to stop UIrefreshing after certain hours of execution, else it causes the system to slow down after a certain time of continuous usage of this UI in the below example to overcome this case we use to check session login time and stopping form to refresh after certain hours of execution. Recommended to use this on pages that hold less data or smaller data sets. - NoofSeconds .value() is an integer control on UI that allows the user to choose a value.( best to fix a value like 5 seconds or a Minimum value to avoid unnecessary executions) Create a new form method and create as of below. void refreshFormWithTimeout (AsyncTaskResult _result)     {         System.Exception ex;         try         {              if(!element.closed...

Debugging Technics in X++ (AX)

Interrupting the code execution : When you have written some code that is causing an endless loop (or a very long execution) and you want to know what code is currently keeping the client busy. The easiest way is pressing [Ctrl] + [Break] on the keyboard. This will stop the code execution and show up a message box: Are you sure that you want to cancel this operation? If you hold down the [Shift] button on the keyboard while you click at the No button of the message box, the AX Debugger will be launched exactly at the line of code that was about to be executed. From here you can continue to step over / into line by line and try to identify the cause of your endless loop. If breakpoint is sometimes not hit? Sometimes it happens that a breakpoint is not hit although you are sure the respective code was executed  instead of putting a breakpoint at a line of code insert the breakpoint keyword. public void executeQuery() { breakpoint; super(); } How can I get the curr...

Exporting xpo'ss throught X++

 Job used for build batch application to take backup of developement in terms of xpo . Following job illustrates how to export/backup all AOT Classes object. void ExportXpoExample() { TreeNode treeNode; FileIoPermission perm; #define.ExportFile(@”c:\AOTclasses.xpo”) #define.ExportMode(“w”) perm = new FileIoPermission(#ExportFile, #ExportMode); if (perm == null) { return; } perm.assert(); treeNode = TreeNode::findNode(@”\Classes”); if (treeNode != null) { // BP deviation documented. treeNode.treeNodeExport(#ExportFile); } CodeAccessPermission::revertAssert(); }