Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

 

Use the Get(LastMessageChoice) function:

 

If[Get(LastMessageChoice) = 2]

Exit Script

End If

  • 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?

 

post-71326-0-02618800-1423577145_thumb.j

"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.

In the Specify Calculation dialog, select Get Functions in the View dropdown.

post-75181-0-90216100-1423580015_thumb.p

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.

 

 

Oh, there are many ways: hidden webviewer, passing the original value to a script trigger..I prefer globals.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.