AnsweredAssumed Answered

Run Filemaker Script on New Record Created via PHP API

Question asked by tom_m on Jan 17, 2019
Latest reply on Jan 20, 2019 by user19752

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();

Outcomes