Every now and again I revisit a piece of code to see if it could be improved on. Unfortunaetly I don't think so this time but thought I'd put it out to the the wider area network.
Validation is set within the field dialog with custom dialog supplied.
As a general practice I include a sub script at the begining of scripts that indirectly cause the comitting of a record and hence catch any field validation repercusions early and proir to any script actions. A validation triggering sub script as such. Please see attached file.
In effect the validation script commits the record and hence allows the field validation to present errors if applicable.
As we know field validation can present different options that require different responses ("Revert Field" "No" "Yes"). So my real problem is does anybody know how to determin while a script is running whether the user chose "Revert Field" as opposed to "Yes". ("Yes" being where the field allows user to override validation). Please see attached file for example.
I have tried using a timestamp field with auto enter of record modification. This unfortunetly updates on "Revert Field" or "Yes".
Also tried Get( RecordModificationCount" ) which is set to 0 on record creation and remains 0 for either "Revert" or "Yes" on first run. Which seems counter intuitive when you compare to how the timestamp field behaves on creation and then "Yes".
Current working approach
1. Capture errors
2. Commit the record
3. If errors are caught then
turn off capture
recommit (to see applicable validation message)
Although this is nice it isn't elegant because the if the user chooses "yes" to override then there is no reason why the supra script shouldn't be able to continue.
Any thoughts appreciated.