Wednesday 11 July 2012

Simple Steps To Create Number Sequence In Ax2012


           
Creating number seq:

 Hello Friends,
Today i want to describe about how to create number sequence in AX2012

It is same as like as we know in Ax2009 but small steps is added in AX2012.don't worry just follow the below steps simply we will get number sequence in AX2012.

We will Take a EDT name as "Car Id" and create in number sequence.For that first we should select a module for new number sequence for example project module.
                                   
steps:

1.  Create an edt : CarId .

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

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

{
     datatype.parmDatatypeId(extendedTypeNum(Car Id));
     datatype.parmReferenceHelp(literalStr("@SYS334483"));
     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 Projparameters Table

     client server static NumberSequenceReference numRefcarId()
{
     return NumberSeqReference::findReference(extendedTypeNum(car Id));
}

4.Write a job and run that

static void Carid(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 number(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(Car Table):

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(ProjParameters::numRefcarId       ().NumberSequenceId,
                                                             element,
                                                             CarTable_DS,
                                                             fieldNum(CarTable, Car Id)
                                                            );
    }
    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)
    {
        CarTable.validateWrite();
    }
    return ret;
}

Link Active()

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

 Now our numberseqence is generated .

*** Set the field or Tabpage Allowedit property to No.
***Check the continues on wizard.

















24 comments:

  1. Steps are illustrated in a lucid manner. Thanks a Lot . . . I have done Number Sequence in Ax 2012 today .

    Thanks & Regards,
    Srinivasan.P

    ReplyDelete
  2. Really Helpful...Thanks a lot..


    Thanks & Regards
    Pranav.G



    ReplyDelete
  3. thanx a lot bro..
    didn't know that I have to create a job first.

    ReplyDelete
  4. Nice Quick Steps Tutorial. Appreciated.

    ReplyDelete
  5. Hi Swathi,

    Thanks for Your providing number sequence, this was very useful for me.
    Can you please provide any project documentation for practice purpose.

    Thanks,
    Srinivasulun.

    ReplyDelete
  6. It is very useful to all, step by step clearly specified.
    Thanks allot Swathi.

    ReplyDelete
  7. Thank You,explained neatly.

    ReplyDelete
  8. Hi Swathi,

    After i follow the steps above to create the number sequence, my field does not automatically update after i created new record in the grid. May i know in the EDT do i need to set table reference? Seems like i get the wrong sequence number.

    ReplyDelete
  9. Hey i have a question here,after generating number seq ref ,my application its creating scop Param : as a shared ,why its creating like that ..Do you any idea about this.

    I want to select that too company..

    ReplyDelete
  10. how to generate the numbersequences for purchaseorder based up on the vendgroup in all purchase order

    ReplyDelete
  11. Hi Swathi..
    it's very easy to learn generate the number sequence .if possible update more tutorial as like this......

    Thanks

    ReplyDelete
  12. How to generate multiple number sequence in AX 2012

    ReplyDelete
  13. On compiling the job at step-6, i got the following error...

    "Numbers could not be generated because a number sequence reference is missing. Ensure that all necessary number sequences are set up."

    Am i missing something...??

    ReplyDelete
    Replies
    1. Hi Swathi,

      Nice article by this i got very good exp in Numbersequence generation.Please update more article's as like this.

      Thanks alot.......................

      Delete
  14. Excellent & a Informative article !!

    Used this for creating a new sequence id for a custom table in Sales & Marketing module.

    Keep Posting more.
    Thank you

    ReplyDelete
  15. Excellent article but you have missed the numberSeq.used()

    ReplyDelete
  16. Great Post!!!
    Simple Steps To Create Number Sequence In Ax2012
    app development

    ReplyDelete
  17. Thanks for sharing this article, it might be very useful for nerds like me.
    Anyway, I manage a company with microsoft dynamics software and there were some bugs lately. I tried calling dynamics 365 support and they said they can come and fix this next week. Is there any other place I could call that can help? Thank you in advance.

    ReplyDelete
  18. Thanks for sharing an useful information we appreciate your valuable information and it usefulness.Sunbridge Software Solutions Pvt. Ltd. Is a Microsoft Dynamics partner practising more than decade has worldwide customer footprints. Microsot Dynamics 365 service provider in India. We offer Microsoft Dynamics AX, CRM and NAV making it your all-in-one Microsoft Dynamics 365 business edition partner Apart from providing the perfect software for your company, we also offer software implementation, support and training. Contact us: Email: info@sunbridgeindia.com, call us: +91(20) 22953290

    ReplyDelete
  19. Thanks for sharing an useful information we appreciate your valuable information and it usefulness.Sunbridge Software Solutions Pvt. Ltd. Is a Microsoft Dynamics partner practising more than decade has worldwide customer footprints. Microsot Dynamics 365 service provider in India. We offer Microsoft Dynamics AX, CRM and NAV making it your all-in-one Microsoft Dynamics 365 business edition partner Apart from providing the perfect software for your company, we also offer software implementation, support and training. Contact us: Email: info@sunbridgeindia.com, call us: +91(20) 22953290

    ReplyDelete
  20. nice blog. thanks for sharing Devops Tutorials. It’s really Helpful for me.
    Microsoft Dynamics AX Online Training

    ReplyDelete
  21. Sir,

    System run 2 number sequence sets in parallel (Ex:- F.Y.2019-20 & F.Y.2020-2021)

    ReplyDelete