How can I conditionally validate certain fields on a given NAV entity?

A simple (probably over-simplified) use case to describe the problem:
Suppose you are loading sales orders into NAV and you wish to add a line to the bottom of each order that holds some sort of note text in the description field. Your basic DTS would likely be attempting to add line items through a single step that links to both the item number field and the description field.

The symptom:
When adding an inventory item you will populate the sales line type field with " item" and the item number field with a valid item number, per NAV requirement. The validation logic on the item number field is executed and the line will be successfully created on the order.

When adding the line item for the note at the bottom of the order, the sales line type will be empty and so would the item number, per NAV requirement. When doing this in the UI, it appears that the validation logic on the item number field is skipped due to the values in one or both of these fields and the line is successfully created. When entering an empty line type using Scribe, even if you put no value in the item number field, the validation code is still executed. It does not find a valid item number and you are not able to add the line.

Root cause:
NAV is executing validation code based on field values when performing operations in the UI. However, when Scribe does this, there is no way to conditionally execute validation logic based on field values in the record, so the same validations execute in both cases.

Scribe has opted not to add this level of complexity to the configuration of the ScribeValidationRules table based on the low number of times that this issue has come up.

The recommended workaround for this is to configure your DTS to execute a separate step for lines that require different validation rules. So, in the simplified example above, instead of just putting and empty string into the line type and item number fields when processing the description line, route the logic to a separate step that does not link the problem field or fields. Clearly this can apply across many fields and/or objects so whether you configure a DTS in this way depends directly on if you need to make use of different sets of validation rules for that entity based on various field values.

We have also had at least one consultant modify parts of the validation logic to look for empty strings in specific fields and conditionally execute the validation logic. That is not a solution we would outline here but a qualified NAV consultant could help you with this type of resolution to the issue.

Posted by Michael B. on Dec 14 2011 6:31PM { U17 , F4 , T2340 , C7526 }