Jump to content

OnObjectEnter trigger vs Field Validation

This topic is 4310 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I know there are various pros and cons for using field validations over script triggers when validating data, but...

In a solution I'm currently working on, it will go to the user with a set of fixed pre-entered preference data in a couple of tables and layouts, to which the user can add to. Edits and deletions are only permitted on the user added records, not the original pre-entered data. A flag "userentered" set to 0 on the pre-entered, and set to 1 on user entered data.

This is easy to use in the field validation section, only allowing changes when userentered=1.

However the stock validation button is clumsy using the "revert" language and doesn't offer other custom dialog options. So I've been experimenting with OnObectEnter (I can't see which other trigger is better to use), on the fields. Now when a user clicks into a field on a record where userentered<>0, the trigger script shows a message indicating that it can't be edited, but offers more options to add or duplicate for a user defined record based on the original (rather than a dull "revert" button).

There is nowhere else in the system these type of "preference" records can be edited, it'll be a locked down runtime version, fully secured, so any odd batch edits/changes are of a concern, and in addition a full set of custom menus are provided trapping for default all new, dupe, delete etc with scripts.

Are there better ways to achieve this? I've tried OnObjectSave, but that still saves any changes regardless of whether it exits with true or false (am I missing something here?). Ideally I'm looking for a trigger similar to a VB/VBA OnModify / OnChange event...

Link to comment
Share on other sites

Perfect, great example too, thank-you Fitch!

Moved to OnObjectValidate and kept the rule for validation in the field validation. I use an OnObjectValidate script to check the value of the userentered flag, and if it's <>1, if shows an more friendly error with options and then reverts the field back.

This is much more friendly than my original OnObjectEnter, as it also allows the user to copy the text from the fields if required, definitely a great addition when moving from v10 to v11!

Link to comment
Share on other sites

This topic is 4310 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.