Applicability
Applicable for Mobile WMS version 3.11 and above for Dynamics 365 Finance and Operations and Dynamics AX 2012
In this article we will:
- See how to add online validation to a custom fields in an Unplanned Item Registration flow from X++ code.
- How to add online validation to the standard dimension fields in an unplanned flow
Adding online validation to custom collector in flow
To add online validation when using one of the MobRegistrationCollector classes, you need to pass the document name for the validation on the setOnlineValidationDocument method.
An example of this can be seen here:
Once this has been done, you need a corresponding method for the validation. In this case It could look like this:
If we jump to the device, and try to enter something in the location collector, we get an error matching the one from the code:
Adding Online Validation to standard dimension fields in flows
If a flow needs to pick up dimension value pertaining to a specific item Id, the MobInventDimHelper static method GetInventDimCollectors is normally used.
In the following example we will try to add an online validation to the batch number in the unplanned move flow.
From Mobile WMS version 3.11 the getInventDimCollectors method has been updated to the following parameter profile:
The OnlineValidationDocuments parameter can be utilized the following way:
It is a map where you add the fieldname of the inventDim dimension field you want online validation for. The key is the fieldname, and the value is the document name of the validation method, in this case "BatchValidation".
The validation method is the same principle as the previous example:
With this implemented we can try to enter a batch number on the device, but because of our validation method, we are unable to move past the step.
To make the user pass the step, simple don't throw an error in the validation method.