analyzeInventoryRecords

Analyze the inventory records related to a sales document, purchase document, Inventory Registration, Inventory Write-Off or Inventory Transfer, and detect errors (eg. missing records, duplicate or orphaned records).

This API call is intended for technical maintenance and investigation. We do not expect it to be useful for end-user workflows. There are no guarantees that the returned information is useful for making any decisions, and the API fields are not guaranteed to be stable: fields may be removed or renamed.

The API call should only be used for documents that are actually supposed to have inventory records. Sales orders, sales quotes, purchase orders, for example, do not have inventory records; the API call may report misleading information for these.

Input parameters

Parameter name Description Possible value Required
referenceType

Document type.

The accepted types are:

  • 1 - sales document
  • 2 - purchase document
  • 3 - Inventory Transfer
  • 4 - Inventory Write-Off
  • 5 - Inventory Transfer

integer yes
referenceID Document ID integer yes

Response

Field name Type Description
records array Just a detailed list of all inventory records linked to the given document. This part can generally be ignored.
referenceRowIDs string A comma-separated list of document row IDs. This is a collection of unique "referenceRowID" values from the inventory records above.

In case you want to remove all records related to the document, this ID list would be useful as input to API call cancelInventoryRecords. However, in that case, all these records should also be listed under "orphanedRecords" and "orphanedRecordRowIds"; it is strongly advisable to cross-check the two lists.
mismatchStatus string "ok" or "error". "error" indicates that there is a mismatch between document rows and inventory records.
mismatchInformation string A message explaining the issue.
mismatches array A list of the mismatches: what is the product ID and quantity on the document row, and what is the product ID and quantity in inventory records.
orphanedRecordStatus string "ok" or "error". "error" indicates that database contains inventory records which are not supposed to be there — the document is not supposed to have them.
orphanedRecordInformation string A message explaining the issue.
orphanedRecords array A list of those records (which are not supposed to exist)
orphanedRecordRowIds string Comma-separated list of document row IDs which those orphaned inventory records are associated with. This list can be used as input for API call cancelInventoryRecords.