February 10, 201510 yr 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
February 10, 201510 yr Use the Get(LastMessageChoice) function: If[Get(LastMessageChoice) = 2] Exit Script End If
February 10, 201510 yr Author 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? Â
February 10, 201510 yr "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.
February 10, 201510 yr 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. Â Â
February 10, 201510 yr Oh, there are many ways: hidden webviewer, passing the original value to a script trigger..I prefer globals.
February 10, 201510 yr 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.
Create an account or sign in to comment