Is it possible to avoid accidentally changing an important field to add a stop prompt question? Are you sure you want to change this field?
Not sure if this is precisely what you mean, but I routinely include a get-out loop in certain types of script—where something significant is to be done, and there is a possibility users might click the button in error, or out of curiosity. At the head of the script I include a loop along the following lines—
#—option for user to do nothing if they activated this script in error
Show Custom Dialog [ Title: "Just checking ..."; Message: "This will do <insert your own advice here>.¶Are you sure this is what you want to do?",
Default Button: “CANCEL”, Button 2: ; "Yes" ), Commit: “No” ]
#—escape if "CANCEL" is selected
If [ Get ( LastMessageChoice ) = 1 ]
Exit Script [ ]
#—keep going if "Yes" is selected
Clicking the CANCEL button allows the user to escape doing anything.
Yes it is possible.
The onObjectEnter trigger can bring up this dialog before the user changes the data. OnObjectSave can do the same after the data has been changed.
Restoring the value if the user says “no” without reverting all unsaved changes to the record takes a bit of additional scripting—especially for drop down lists and pop up menus.
To do that, you can put the field being edited in the script parameter of OnObjectEnter and then the script can access the script parameter to get the ore-edit value. This helps get around a bug where drop down lists/pop up menus allow the user to select a value before onObjectEnter can perform a script.
Thank you! This did the trick. My script was not running correctly. Just what I needed!
Retrieving data ...