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

Script Button

Featured Replies

I'm creating a databse with a main menu page. I created a button linked to a script I made. Funny thing is when this button is clicked, it doesn't work right. Whereas, from the same menu window, if I click on the script name from scriptmaker menu, it's fine.

I checked the specify button dialog, and the button is correctly linked to the right script.

Try change your scriptname. And repeat link your buttom link.

Or delete and create new button.

Hi NCE,

There are only four differences between firing a script from Specify Button or from Script Maker (that I am aware of) ...

1) You have turned off (through Field Behavior) access to the field. If you specify Go To Field[] for instance (from Specify Button), it will not work if field access has been turned off. It will only work if specified through Script Maker.

2) An attached script parameter can only be specified from Specify Button. So the button click may be picking up a parameter but when executing from ScriptMaker, it can not.

3) A script fires depending upon the current layout at the time it is executed. And you may be firing each instance of script from a different layout table occurrence.

4) You have a script-step which requires the field be on the layout (such as Insert Calculated Result[]) and, in one instance, you are on such a layout and in the other instance you are not.

It is also possible to have two scripts attached to the same grouped set if they were grouped after different scripts were attached. A bit to the left and one script fires - a bit to the right and the other script fires.

If above four items aren't the culprit, drag around that button and keep hitting Arrange > Ungroup until the option isn't available any more. As you ungroup, FM will ask you if you wish to disconnect the scripts as well. Once the button is again 'clean,' reattach your script. wink.gif

LaRetta

Hi LaRetta,

Your last suggestion " ... ungroup until... " is the one I run into the most. It is usually a "No Fill", "No Line" graphic that is part of the button that turns out to be culprit.

HTH

Lee

In prior versions I would tend to agree, Lee.

But #2 and #3 are unique to vs. 7 and you'll see more of these kinds of misfire questions. Proper layout (table occurrence) and improper script parameter passing were what caused me the most problems when new to 7 (and can still catch me off guard). I remember spending hours trying to figure why a script with a parameter wouldn't work when tested from Script Maker but worked fine from the button - or a new record script working fine from a button on a layout and same script attached to another layout not creating the same new record. crazy.gif

Simply recreating the button would be the quickest test for sure. But because we weren't told even the concept of the script in question (to narrow it down), it's all speculation. Even GTRR can appear not to respond, if no related records found (whose ID could be based upon script parameter).

I hope I covered all possibilities to check so we don't have to play guessing games and waste NCE's (or our) time. I think it's the Butler in the Library with the candlestick myself. wink.gif

  • Author

Hey, LaRetta. Seems like #3 is the culprit. Am doing some tweaking now and hope all will be ok.

However, seems kind of odd to me that a script should be fired from a specific TO. I figured with the correct script steps, it should work independent of the particular TO you are on. From a newbie's perspective, isn't this something that can be improved on FM7?

Thanks very much, people. This forum is a gem for newbies like me.

Scripts can be triggered from anywhere you like. The results of some script actions, however, depend on where you are at the time - for example, Delete Record/Request. So it's best to put a Go to Layout script step somewhere at the beginning.

  • Author

thanks, comment. i'm just reading up on scripts and it does seem that there are instances that a script would require being in the right context when it is performed.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.