FileMaker PHP API - newPerformScriptCommand and Script Errors

Discussion created by fmdataweb on Jul 9, 2017
Latest reply on Jul 10, 2017 by User26869

I'm trying to understand what could generate an error when performing a FileMaker script from via the PHP API using the newPerformScriptCommand command, e.g.


$scriptObject = $fm->newPerformScriptCommand($layoutName, $scriptName, $scriptParams);

// Execute the script

$scriptResult = $scriptObject->execute();


if(FileMaker::isError($scriptResult)) {

// FileMaker PHP API Error -- Alert User.

$scriptError = 'Perform Script Error: '. $scriptResult->getMessage() . ' (' . $scriptResult->code . ')';

} else {

// no error - continue on



I realise that if any of the newPerformScriptCommand parameters have errors like an invalid layout name or script name it will return an error, but I'm more interested in when the actual FileMaker script encounters an error when will it cause $scriptResult to return an error? For example I was just using this to call a FileMaker script - there was an issue with the FileMaker privileges for a table I was trying to create records in, but the script executed correctly as far as the PHP API was concerned. I only found out about the issues by looking at the Log Viewer in the FileMaker Server Admin Console after noticing the records were not being created.


Is there a way to exit the FileMaker Script with a script result that will generate an error with the $scriptResult? Do any FileMaker Script steps cause errors that will lead to an error result when executing the newPerformScriptCommand command?