New number sequence not visible in Dynamics AX 2012. How to fix it?

Hello readers,

In Dynamics AX 4.0 and Dynamics AX 2009, if you created a new number sequence reference, you would restart the AOS to see the new number sequence reference in the parameters form of your module. That was all you had to do to get the new reference reflected.

Try the same in Dynamics AX 2012 and you will be pleasantly suprised(or maybe bewildered) to not find the number sequence reference showing in the parameters form. This is because the numberSequence tables are no longer populated when you restart the AOS. This was an additional task that was done in Dynamics AX 4.0 and Dynamics AX 2009 everytime you restarted the AOS. In Dynamics AX 2012, the number sequence tables are populated when you select the appropriate task in the initialization checklist.

So, how do we work around this issue?

Simple. Just call the load() method on your module's number sequence class.

For example, suppose I've added a new number sequence to the Sales and Marketing module(CRM).

So my code will be,
    NumberSeqModuleCRM module;
    module = new NumberSeqModuleCRM();
If you have added multiple number sequences to multiple modules, you can simply call the NumberSeqApplicationModule::loadall() method and it will create all the number sequences.

Be aware that when reinitializing all number sequence references, there should be no existing number sequences already defined in the system or you will get a duplicate record exception.

Thats all for today. Do check back soon as we keep learning.


Popular posts from this blog

How to add empty ranges in query

Get selected records in Dynamics AX 2012

How to refer to form controls in code without setting the AutoDeclaration property in Dynamics AX?