AX 2012. High “System Id” Number Sequence consumption or how incorrect setup can affect AX.

Recently we did a performance analysis for one of our customers using DynamicsPerf utility. Analyzing number sequence consumption, to determine preallocation quantities, we noticed high system id usage in one of the companies (50 000 per day). We went through a list of possible entities that could consume this number sequence and realized that only sales order invoices are posted on a daily basis. However, the quantity of invoices is less than ten per day and could not be a case.

After additional investigation, we found a sales order invoice posting batch job scheduled with 1-hour recurrence.

This batch job had a late selection parameter checked and quite strange selection criteria:

SelectionCriteria

Bingo! As you can see here AX should process all orders irrespectively of status. In this company we had 10000 of posted sales orders, because of incorrect setup batch job iterates through each order and creates one batch task per 5 orders (depending on setup in accounts receivable parameters, that is 5 by default). Each batch task allocates new parmId from system id number sequence. So, 10000 orders will create 2000 tasks every hour that leads to 48000 tasks per day!

This is a good example how incorrect setup may add additional overhead to overall system performance creating thousands of batch tasks and doing thousands DB calls. And the fix is pretty simple – exclude invoiced orders from selection criteria.

 

Advertisements

Cannot create a record in Dimension history for documents (InventReportDimHistory). Error on Vendor invoice posting.

Usually we can get this error for non PO vendor invoice.

To fix it you need to change one of these two number sequences:

  • Internal invoice
  • Internal credit note

AP_NumberSeq.jpg

Because if they have identical structure they will generate  same numbers and that’s the real cause of this error.

Now let’s look what is happening under the hood.

Unique index of InventReportDimHistory consists of four fields:

  • TransRefId
  • InventTransId
  • TransactionLogType
  • InventDimId

InventTransId is always blank, because non PO invoice lines could have only non-stocked items or procurement categories.

InventDimId could be identical for multiple lines, for example “AllBlank” or any site and warehouse combination.

TransactionLogType is a document type. For invoice it is “PurchInvoice”, for packing slip –  “PurchPackingSlip” and so on.

The last field is TransRefId which is based on InternalInvoiceId field from the Invoice Journal.

InternalInvoiceId is number sequence generated, so it should be unique for each posted invoice.  However, AX could use two different number sequences for this field.

First one is used for invoices and second for credit notes and if this two number sequence have same structure, for example usmf-#######, you could hit this issue when you will create credit note, because at some point AX could generate number for credit note that was already used for invoice.

Please note that other number sequences can be used for some localisations like RU or MY. To get list of all possible number sequence you can look at PurchInvoiceJournalCreate.allocateNumAndVoucher() method.