- Optionally Block Records That Fail Validation.
Allow the user to determine if they want records that fail validation to be blocked e.g. if a item record fails validation then set the blocked flag to true.
Add a new field to the Data Validation Template card, Block Records on Failing Validation. When the table ID is validated check if the selected table has a field called "Blocked". Only make the "Block Records on Failing Validation" field visible if there is a blocked field.
If there is a blocked field, check that datatype of the field. If it is an option, show another field - "Blocked Value". This field should provide a lookup to the option string values (see FieldRef.OPTIONSTRING) so that the user can select the appropriate value i.e. for customer and vendors the user will need to decide whether to set the value to Ship, Invoice or All.
If the user types directly into the field, validate that their entry is a valid option in the option string.
When a record fails a validation rule and the template is set to Block Records on Failing Validation open a FieldRef to the blocked field:
If the field is a boolean, and blocked is not already true then set it to true and modify the record
If the field is an option, find the option value (integer) that corresponds to the Blocked Value from the template. If the Blocked field does not already have that value set it to that value and modify the record.
Might just need to be careful about validation that is called from a card page. If the validation fails, a different copy of the same record could be modified by the validation. We might need to reload the copy of the record that the page has.
- Not checking Block Record on Failed Valid- COD9030389.BlockRecordOnFail check "Data Validation Template"."Block Record on Failed Valid.", exit if false.