Jondb Posted February 10, 2015 Posted February 10, 2015 Hi- I've added a 'show dialog' script step to a script. When testing the dialog I find that both the OK and Cancel buttons allow the script to continue. I want the 'cancel' button in the dialog to cancel the rest of the script and revert the field, but I can't find how to do this. Checking and unchecking the 'commit data' boxes in the Dialog setup doesn't seem to do the trick. Any help appreciated. Thanks
doughemi Posted February 10, 2015 Posted February 10, 2015 Use the Get(LastMessageChoice) function: If[Get(LastMessageChoice) = 2] Exit Script End If
Jondb Posted February 10, 2015 Author Posted February 10, 2015 Thanks for the quick reply, doughemi-  I tried inserting an 'If/End If' condition after the custom dialog step, but the [Get(LastMessageChoice) = 2] option doesn't seem to be available as a script step. How do I insert that function into the script? Â
bcooney Posted February 10, 2015 Posted February 10, 2015 "want the 'cancel' button in the dialog to cancel the rest of the script and revert the field," You may wish to design the UI using a popover with global fields instead. In that way, the user must click an OK in order for the edited value to be committed to the record. If you are really using FM12, then use a modal window.
doughemi Posted February 10, 2015 Posted February 10, 2015 In the Specify Calculation dialog, select Get Functions in the View dropdown. However, I missed the part about reverting the field. Â Barbara's answer is the correct one. Â Otherwise, there is no easy way to save the original value to reinsert into the field. Â Â
bcooney Posted February 10, 2015 Posted February 10, 2015 Oh, there are many ways: hidden webviewer, passing the original value to a script trigger..I prefer globals.
comment Posted February 10, 2015 Posted February 10, 2015 I want the 'cancel' button in the dialog to cancel the rest of the script and revert the field What exactly does "revert the field" mean in this context? Going by your screenshot, you actually want to clear a field - not revert it to some previous value it might have had. Which should be really easy to do as: ... If [ Get ( LastMessageChoice ) = 2 ] Set Field [ YourTable::SomeField ; "" ] ... End If ... Moreover, since it appears that the field is actually populated by the same script, you may streamline the process by asking first, shooting later: Show Custom Dialog [ Message: "Are you sure ...?"; Buttons: “OK”, “Cancel” ] If [ Get ( LastMessageChoice ) = 1 ] Set Field [ YourTable::SomeField; Get ( CurrentDate ) ] Commit Records/Requests End If Note: you should (almost) always use Set Field to populate fields, rather than Clear or Insert Calculated Result.
Recommended Posts
This topic is 3846 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 accountSign in
Already have an account? Sign in here.
Sign In Now