I would like to run a script in Filemaker on a new record created via a PHP script.
I currently achieve this by assigning the Filemaker record with a unique ID I generate in PHP, and then pass that unique ID as a script parameter into my Filemaker script. The Filemaker script then performs a find for the unique ID, then performs the rest of the script tasks.
My question is, is there a way to skip assigning the record a unique ID and having the Filemaker script locate it. Is it possible just to perform the Filemaker script on that newly created record? Sorry if my wording is confusing.
Thank you very much for any ideas!
Tom
-----
My current PHP script…
/* FILEMAKER SECTION */
//Connect to FileMaker database.
include('FileMaker.php');
$fm = new FileMaker();
$fm->setProperty('database', 'PHPtest');
$fm->setProperty('hostspec', '127.0.0.1');
$fm->setProperty('username', 'Admin');
$fm->setProperty('password', '1234');
// create new record
$action = $fm->newAddCommand('php_layout');
// set fields
$action->setField("data_field", $data);
$action->setField(“php_uniqid", $uniqid);
//EXECUTE THE COMMAND
$result = $action->execute();
//CREATE PERFORM SCRIPT COMMAND
$command = $fm->newPerformScriptCommand(‘php_layout’, ‘filemaker_script’, $uniqid);
//EXECUTE THE SCRIPT
$result = $command->execute();
There is setScript() "Inherited From FileMaker_Command" so you can set it before execute(),
$action->setScript( 'filemaker_script' , 'param from php');
I saw Get(FoundCount) is 1 when the script is called after adding a record, tested on FMS17.