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.

Script on moving to a different record

Featured Replies

Hi all

I don't know if it is possible or not but I want to run a script when i go to a different record but not necessary changing record contents (this means zippscript plugin with validation calculation is out of the question).

This means every time i view a different record in a form view a script will happen.

Is it possible

Thx

What do you want the script to do when you change records? IMO, zippscript, etc. are usually thought of in connection with running scripts when entering or exiting fields.

Without more information about what you are trying to do, we would be guessing.

Lee

Hi Ayman

This means every time i view a different record in a form view a script will happen.

Trigger on record change and not layout change?

How many ways do you allow a user to get to another record? buttons, menu, etc.

Reason for question is if the the options are limited you could control movement. Say navigation is by next/prev buttons, you could attach a perform script step to your navigation scheme. With a method like this you would have to lock down record to record navigation, but it would work.

HTH,

Tim

  • Author

probably it is the only possible way to do it

i was hoping there are other ways

What you are trying to accomplish is navigation driven, so the trap/trigger has to be navigation driven as well.

Sorry, but I know no other way to trigger a navigation event.

Tim

It should be quite easy to trigger a script on navigation by a calculation that re-evaluates on screen refresh - such as an unstored calculation field, or a web viewer, or a conditionally formatted object.

The trickier part is NOT to trigger the script on every screen refresh - this could be controlled by a variable.

Comment,

Good, how would it look?

Global unstored calc set to Get(RecordID)??

I have tried to do this kind of thing to test for required fields (left blank)in the past?

Any ideas on the best way to do this kind of test?

Tim

There's no such thing as "Global unstored calc" - global calculations are stored. You need an unstored calculation.

Take a look at the attached file - it uses a calculation field, but as I said, a web viewer or a conditionally formatted object could be used just as well.

Note that I do not use plugins routinely, so the precautions I took against unwanted triggering may NOT be adequate. Use at your own risk.

NavigationTriggeredScript.fp7.zip

Case ( 

not Get (WindowMode) and $$serialID and $$serialID ≠ SerialID ;

Let ( [ $$serialID = SerialID ; script = mFMb_DoScript ( "MyScript" ) ] ; "Script ran at " & Get ( CurrentTimeStamp ) ) ;



Let ( $$serialID = SerialID ; "Nothing happened at " & Get ( CurrentTimeStamp ) )

)

not Get (WindowMode) = works in browse mode only

and $$serialID = works only after first pass thru the calc

and $$serialID ≠ SerialID = tests for key field change

Do I understand this correctly?

I like this, but as you noted a plugin is requred.

Which is not a problem for me.

I am just trying to grasp the logic and want a confirmation. In actual implementation when would you clear the $$Serial, or is it o.k. to leave it be.

Thanks,

Tim

not Get (WindowMode) = works in browse mode only

and $$serialID = works only after first pass thru the calc

and $$serialID ≠ SerialID = tests for key field change

Do I understand this correctly?

Yes, except the last one tests for moving to a different record. There's no relationship involved here, hence no key field.

In actual implementation when would you clear the $$Serial

Probably only when the file is closed. Note that you must be careful not to use the same variable name elsewhere. Also, if you want to implement this in other tables, you'll need a separate $$variable for each. Perhaps there is a more elegant method to handle this, but as I said I haven't really looked into using plugins.

Thanks a lot, Comment :(

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.