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 ends and does not keep cursor in last "go to field" step

Featured Replies

Hi...I created a script trigger to perform actions when a selection is made from a pull down menu inside a portal row. The source table is called Projects and the portal source table is called Assign Client to Project.

Everything works perfectly until the last steps:

Go to Layout [original layout]

Go to Field [Projects:status]

I used the pause/resume script step to watch what is happening, and it does actually go to that field but doesn't end there.

Instead when the script finishes, the cursor ends in the field that is the beginning of the next portal row from where it began.

Any ideas? I've tried having it go to many different ending fields but it always ends up back inside the portal.

Hello, Annie,

I was having a hard time figuring out what you meant by your explanation.

Can you explain a bit more.

You can use the Go to Portal Row, script step as well, maybe that could help you.

Edit: I think what you are experiencing is natural due to the tab order of the fields in the portal. When you reach the last field on a portal row, it will go to the next portal row, so I think you are going to need to capture a value from the portal row you are in before you run the script and at the end of the script go to that portal row.

Edited by Guest

  • Author

Hey thanks for the response!

Here is the problem...when I come back to the orignal layout at the end of the script, I do NOT want to end up in a field in the portal. I want to end up in a field on a different part of the layout.

That is what my script step "Go to Field [Projects:status]" was meant to accomplish, but at the end of the script I end up inside the portal instead of in the field Projects:status. Even if I add a final script step of committing the record, it still ends inside the portal.

I hope that is a bit better :B

Try this:

Go To Layout []

Go To Field []

That should force it out of the portal.

hope that helps :B

-Jeanny~

maybe try putting your gotofield step after a commit or refresh step

just a idea

It would be helpful to see the script that is triggered. Can you post it (print to pdf).

  • Author

Hi Jeanny - that is initially what I tried but it is not getting me out of the portal. Thanks though!

  • Author

Hi - thanks for the reply.

Attached is the script I am working with. It is triggered OnObjectSave from the first field within a portal where a contact is chosen and related to the project I am on. The portal goes to a join table for connecting multiple contacts with multiple projects (Called "Assign Client to Project"). The purpose of the script is to find the current company for that contact and then add it to the join table, and then return to the original layout and get you out of the portal and to a field on that project page.

But I am also having the same problem with simpler sripts. Any script that ends with a "go to field" command does not end on that step. When I add a pause script step after "go to field" just to see if it actually goes to that field...it does. But then when I "continue" the script the result I get is to either be outside any fields at all or to be inside a field in the portal (if the script started in the portal). The "Exit Product" attachment is a smaller script and is triggered when the "product" field on the Project layout is exited.

SCRIPT_Assign_Company_to_Project.pdf

SCRIPT_Exit_Product.pdf

  • Author

Good idea with trying to put "go to field" after a committ or refresh step, but I am still getting the same results :B

"find the current company for that contact "

And a "current" company for a contact is defined how?

Do you have in the contact record _kF_currCompanyID? Can't this be a lookup in the join table? Imho, you don't need a script trigger.

  • Author

Yes, wonderful idea! That works so much more simply, thanks!

(Although, I still wonder why I have the "go to field" issue)

  • Author

I found the solution! My problem was that I could not get out of the portal once the script ended even if I used script steps "Go to Object" or "Go to Field."

The answer: use script step "Select Window" and THEN "Go to Field"

Awesome!

  • 2 weeks later...
  • Author

Ok maybe I spoke too soon...

I'm writing this for anyone else experiencing the same problem...the answer has to do with WHEN or HOW a script is triggered. For example if it is triggered by OnObjectExit, the script runs first and then the object is exited and you land in the next field in the tab order (if you tabbed to exit the field). To prevent the event from happening (ie finishing exiting the object and going to the next field in tab order), you should add a script step "ExitScript[False]" so that you the event of exiting does not occur.

I also received this answer from PhilModJunk at the FileMaker support forum:

"If you look up script triggers in Filemaker Help, it'll tell you which triggers fire before the triggering event and which fire after the triggering event. This trigger fires before the event. After your script goes to the specified field, the triggering event then completes and this is what takes it to the next field in the tab order. As stated in the help, for "before the event" triggers, exit [false] should be used to keep the triggering event from actually taking place."

Annie,

I suggest that you take a step back from your use of script triggers. This is a broad statement, but I don't feel that they are as needed for data entry as you think.

Barbara

I agree with Barbara here, perhaps simply because we have been used to not having them around pre fm10 - but let me show how I would do the scenario sans triggers:

--sd

AnnieT.zip

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.