Jump to content

Record load causes endless loop

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

Recommended Posts

FM 12 Adv. I'm trying to use a layout trigger on record load. The script goes to related records on another layout to perform some operations and then returns to the layout. So, when I load a record, the script triggers, goes to another layout, returns to the original layout, and the script fires again. An endless loop! Any suggestions on how I can get around this?

Link to comment
Share on other sites

At the beginning of the script, check for $$flag being set to 1; if it is,  then set it to 0 and exit script. While on the second layout, set $$flag to 1.

Link to comment
Share on other sites

38 minutes ago, john9210 said:

The script goes to related records on another layout to perform some operations and then returns to the layout.

You could add the 'Show in new window' option to the GTRR step and close the window when done.

Link to comment
Share on other sites

A solution example is attached. On the Meeting layout a trigger on the Response field runs the script "Count responses". It updates the data in the box under Response Summary. The button beneath the Summary also updates the data. I need to use the button when changing records because the summary data does not automatically update. I would like to run the script when I change records and I thought that attaching a layout trigger on Record load would do the trick. However, this creates a endless loop because the script changes layouts and returns to the original layout firing the script again. I've tried the "Show in new window" and the "$$Flag" suggestions, but neither works. Is what I'm trying to do possible?

Link to comment
Share on other sites

This topic is 1854 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

  • Similar Content

    • By troi
      Updated script triggering plug-in for FileMaker Pro 17 adds script triggering via a URL.
      Alphen aan den Rijn, the Netherlands, April 23, 2019–Troi today announced the immediate availability of Troi Activator Plug-in 5.0 for FileMaker Pro 17.
      What is Troi Activator Plug-in?
      Troi Activator Plug-in is a very powerful tool for triggering scripts remotely. All from within FileMaker you can:
      trigger a FileMaker script on a different computer (remotely) trigger a FileMaker script over internet use the built-in security to prevent unauthorized triggering send a number (e.g. a record ID) and a long text with the trigger start and stop listening for remote trigger messages with one script step communicate with databases in different FileMaker versions or even runtimes Except from remote triggering you can also use the Activator Plug-in for:
      triggering a script on a specified date and time scheduling events which trigger any script you want running a script from any FileMaker calculation, for example a tooltip calculation validating fields on exiting a record with a custom script suited to your specific needs What is new in version 5.0?
      Troi Activator Plug-in 5.0 is compatible with FileMaker 17 and has the following new functionality:
      Tested and made compatible with FileMaker Pro 17.0.4. Added script triggering via a URL (using the GET HTTP method) on macOS and Windows. You can now trigger a script with a URL like this:
      You can also specify an (optional) password in the URL and add whether you want to wait for a response. In the triggered script you can specify the response text with the new Actr_SetHTTPResponse function or Set HTTP Response script step. The Activator Web Server functionality, including the Image Upload Server functionality, is now also available on Windows. (Windows) Added code signing to the plug-in for Windows. (On macOS code signing was already added in version 4.5). The plug-in now indicates if an external script step is compatible with a product. The step is shown in grey if it is incompatible for that product (for example for iOS) in the script editing pane (center) and the script steps pane (right). (macOS) Prepared the plug-in for notarization: the plug-in can now be added to a runtime, to create a hardened FileMaker runtime app which can be notarized by Apple. Notarization gives users more confidence, as the runtime has been checked by Apple for malicious components. Version 5.0 also has the following changes and improvements:
      IMPORTANT (macOS only) The minimum supported FileMaker version is now FileMaker Pro 14. Also the minimum supported Mac OS version is now OS X 10.9 (Mavericks). You can keep using v4.5.1 for older versions of FileMaker Pro or Mac OS X. (macOS) The plug-in no longer has the 32-bit code included. Updated the EasyInstallTroiPlugins.fmp12 file, it can show additional error information from Get(LastExternalErrorDetail) when it is available. The EasyInstallTroiPlugins.fmp12 file can also run a test registration script for a plug-in after you have installed it on FileMaker Server. Updated the example files for FileMaker Pro Advanced 17 and made small corrections to the user guide. Pricing & Availability
      A fully functional demo version of Troi Activator Plug-in 5.0 is available on the Activator Plug-in page.
      Licenses cost US$ 89 per user. Details on developer licenses and multi-user discounts can be found on the Activator Plug-in page. You can order licenses from our shop.
      Upgrade information
      Version 5.0 needs a new registration. The upgrade is free for users who bought a license for Troi Activator Plug-in on or after September 4, 2017. Eligible users will be sent a new registration. Contact us if you have not received yours after April 26, 2019.
      Upgrades from licenses bought before September 4, 2017 are available from US$ 49 per user. Upgrade prices for other licenses can be found in the shop. You can order upgrades there.
    • By Scott Pon
      Environment: FM13 with FM13 Server, mix of Windows 7 and 10.
      Is there a way to set a script trigger on if this portal row is new? IE, a script to run if this new child/portal record is new.  
      We have a parent record, and portal to Children records.  The children records have 2 fields: Profile Name and Process type.  Our user would like to enter a new child record (profile name and process type).  if the process type already exists, we will need to archive the existing record (matching the profile type).  There is more bI want to start with this first.
      I see script triggers to the layout "OnRecordCommit", but no similar script trigger for portals.  Any ideas on how to handle this?  Or am I going to have to add a button to go to another screen to accomplish this?
      Thanks.  I hope i gave enough info for you to help me.
    • By dav1089
      I want to create a script trigger which opens a layout based on account name ,create new record and put cursor in first field of the new record
      Now, I was able to direct user to specific layout and also created new record using New Record/Request function but somehow it doesn't put cursor in the first field , instead it selects whole record .
      Note: I also have script triggers attached to first and second field which runs on exiting the fields. (I don't think they affect anyways , but just mentioned to give idea)
    • By CRexen
      Hello everyone
      I am currently working on a database, which HR-Managers can access via WebDirect using login-information, to accede or resign their employees.
      I have made 6 possible option types for the HR-employees to enter data into, set by an unique ID, but with the use of the same fields.
      X fields with option type 1 (Accede)
      Y fields with option type 2 (Resign)
      Z fields with option type 3 (Maternity leave / leave)
      .. Etc. 6 option types in total.
      Now, based on my project description, a couple of the fields will have to be validated / not empty, which the HR-manager is prompted to enter before the record can be committed.
      Now, I am aware of FileMaker has it's own Field Validation, but I think the built in feature is bonkers..... (Sorry FileMaker..) 
      Therefore I was thinking of making a script to each of the different fields, which needs validation, and is this even a good solution
      Question one; how do I do this, the most easily? Is it possible?
      I have 8 required fields for validation, fields are global.
      Fields such as; Company Name, HR-manager name, HR-manager e-mail, employee SSN, employee name, employee surname etc. 
      I don't want the scripts to interfere with the other option types ( X, Y, Z ) which each is set by an unique ID, as well as fields, although the fields used in these option types are from the same table.
      Please see attached images of my setup.
      Hope you can help me, for the best possible solution.
      If you need more information, let me know.
      P.S. The language/text on the layout is Danish, although shouldn't be considered an issue for understanding my problem.

    • By Dana G
      Purpose:  To capture the contents of a field before it is changed.  Compare the before to the after.  Highlight the after and screen capture then export.
      I can't get past the first sentence and it's getting frustrating because it seems extremely simple.
      1 Field:  OnDeck_t (text)  -  The OnDeck_t field data = On
      2 Field:  OnDeck_before (Where I want to capture the OnDeck_t before it's changed)
      I have an OnObjectEnter script trigger on the OnDeck_t field that runs this script:
      Set Field By Name [substitute (Get (ActiveFieldName); "_t"; "_Before"); Get (ActiveFieldContents)]
      If I do this it works fine.  (But I don't want it hard coded.  I will be using it for all the fields on the layout):
      Set Field [OnDeck_before; Get (ActiveFieldContents)]
      I have divided the Substitute (Get (ActiveFieldName); "_t"; "_Before") and Get (ActiveFieldContents) into separate lines in Data Viewer and both return expected results.  Why doesn't it work when it's part of a 'Set Field by Name' script step?
  • Who Viewed the Topic

    4 members have viewed this topic:
    comment  OlgerDiekstra  Jeroen de Haan  Lee Smith 
  • Create New...

Important Information

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