Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5407 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted (edited)

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
Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

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

Posted

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

Posted

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

This topic is 5407 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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