When you use PHP you are asking a specific layout for information, then you do not trigger the OnFirstWindowOpen for the file your are running your PHP-file on
I would have thought the PHP page needs to authenticate with the FileMaker file, which would include opening the file with the account name/password which would in turn trigger the OnFirstWindowOpen script? In any case I can't seem to get it to run that script so I'm going to have to assume it doesn't run the OnFirstWindowOpen script when performing API requests.
The Custom Web Publishing Guide states:
Script triggers and Custom Web Publishing solutions
In FileMaker Pro, both scripts and user actions (such as the user clicking a field) can activate script triggers. But in Custom Web Publishing, only scripts can activate script triggers. For information on script triggers, see FileMaker Pro Help.
Note To specify that you want a script performed when a file is opened, you need to use the OnFirstWindowOpen script trigger. Similarly, to specify that you want a script performed when a file is closed, you need to use the OnLastWindowClose script trigger.
So far I haven't seen any evidence that these are in fact triggered by the PHP page - I've added logging to the top of each of these scripts so that it writes some log records when the scripts are performed, and no records are created when the PHP page is performed. The other actions that the PHP page does are working correctly though.
The FMP Help lists Custom Web Publishing as supported for the OnFirstWindowOpen script trigger:
Would love to hear from anyone out there using CWP as to whether their OnFirstWindowOpen scripts are performed from PHP API pages?
You missed this phrase in the documentation:
"But in Custom Web Publishing, only scripts can activate script triggers."
In other words, opening a window doesn't activate a script, nor does any other event ... because the database is never actually opened. No window opens, no objects are loaded. Therefore, there's no recording of events to trigger the script.
You can specify a FileMaker script to run as part of the PHP call.
I did see that reference to "only scripts can active script triggers", but then immediately below that is this text:
"Note To specify that you want a script performed when a file is opened, you need to use the OnFirstWindowOpen script trigger. Similarly, to specify that you want a script performed when a file is closed, you need to use the OnLastWindowClose script trigger"
I'm assuming as its mentioned in the CWP Guide from FileMaker Inc. that it also applies to CWP, and given CWP is listed as supported for the OnFirstWindowOpen trigger here:
I'm assuming that it's supported? Unless I'm missing something here why does FileMaker Inc state that it's supported by CWP? What is the trigger for this to run under CWP?
1 of 1 people found this helpful
You're assuming incorrectly. Files do not open, no windows are created, no triggers will file. Reason: No FileMaker client is launched, which is where the triggers happen.
I just tested this on a CWP solution. The script doesn't fire.
The documentation is a little confusing. I don't know why they say it's supported, because that's just not how it works.