AnsweredAssumed Answered

API - Can't get any script to run ... newPerformScriptCommand

Question asked by oregondean on Apr 29, 2017
Latest reply on May 1, 2017 by beverly

I can't get a script to run via the API.



Simple database with text field.

Super admin credentials ... can do anything (will change to restricted user once debug is compete)
Script runs

     - in FMPA client v15.03 on server v15.02

     - via PSOS - perform script on server with same client

     - as scheduled script on server with same credentials as client (eliminates security/restrictions concerns?)

Using same user credentials I can use the API to access, filter and display records so it's not a FMS server connection issue.  But the script won't run.





require_once ("includes/connection.php");   // see below


// Does not run

$layout = "user AWS single";

$script = "CalledByRegistration";

$parameter = "289";

$request = $fm->newPerformScriptCommand($layout, $script, $parameter);   

$result = $request->execute();

if (FileMaker::isError($result))

{ echo "<p>Error: " . $result->getMessage() . "</p>";  exit; }      // note that no error is throw when the code is executed


//runs fine

$scripts = $fm->listScripts();

// and this runs fine to

$FirstName = 'Dean';

$request = $fm->newFindCommand($layout);

$request->addFindCriterion('namefirst', $FirstName); 

$result = $request->execute();




require_once 'FileMaker.php'; // in same directory as this connection.php file

$database = "xxxx";

$hostname = "";

$username = "xxxx";

$password = "xxxx";

$fm = new FileMaker($database, $hostname, $username, $password);



SCRIPT - CalledByRegistration


Go to Layout [ "PHP_registration" (user AWS) ]

Set Error Capture [ On]

Perform Find [Restore]      user AWS::keyUser:[289]

Set Field [ User AWS:personalStory ;  "hello world " & Get(CurrentTimestamp) ]

Exit Script [ Text Result: Get(CurrentTimestamp) ]



Any ideas what's going on here? I used the API for many years but never had success with executing scripts.  I have reinstalled server many times and have FileMaker.php in my HTML directory where the connection.php file that calls it resides ... and in the root HTML directory.