On Sage 100 Advanced 2018:
I have added a UDF checkbox to CI_Item and SO_SalesOrderDetail, linked so that when a new item is added to the Lines grid the default checkbox state from CI_Item is auto populated. If the value in CI_Item is checked I don't want a user to clear the box, but I can't set the SO Detail field to Read Only because the value is optional for other items so they user may need to change it.
Next I have a script which triggers if a user changes the value of the checkbox. The script will look up the default value in CI_Item and if checked will warn the user they can't change the value, and it restores the checked status. If the CI_Item default is cleared the user may be allowed to check an originally cleared checkbox.
This works beautifully on existing lines and on newly added lines--once the cursor leaves the new line in the grid. My problem is that when entering a new item, if the users tabs over to the checkbox before leaving that line, they are able to clear the checkbox without triggering the script. This is the case whether or not I set it to trigger on column pre-validate or post-validate. I can't use Table Pre-Write because then it would only trigger when saving the entire SO rather than when leaving a new line (it seems... I'm a little fuzzy on event triggers within a grid).
Is there a way to save the line when it is first entered, so that my event script will fire if a change occurs to this column? Or is there any other method I haven't thought of to prevent a user from clearing the box if originally checked, even during a new line entry--while allowing the box to be checked for other items?
Any help will be appreciated.