Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6478 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

I try to execute a FM-script through my FMS 8 advanced, php, FM PHP API environment, but it doesn't work.

I have the following PHP-code:

$fm = new FileMaker('HANDELSWAREN');



$comPerformScript =& $fm->newPerformScriptCommand('ExportProducts', 'ImportProducts', 'hallo'); 

if(!$psValid = $comPerformScript->validate()){

 echo 'Script Validation failed ('.$psValid->numErrors().')';

 exit;

}



$result = $comPerformScript->execute(); 




This code throws the following error:


Notice: Only variable references should be returned by reference in /Library/FileMaker Server/Web Publishing/publishing-engine/php/lib/php/FileMaker/Command.php on line 125

I've spent already the whole day to find a solution, but I wasn't successful. Has anyone an idea what the error could be or how I could do it another way?

Thanks,

jonas

  • 2 weeks later...
Posted

Hey Jonas:

I feel your pain as I was in the FileMaker PHP beta and it took until mid August to get the Public Beta to work with script. Basically, to get any script to work you have to do it like using the setScript command. You can even pass script parameters with the newest version, I have used them and tested them.

This particular example I use to snooze a record for a CRM solution. Basically you click a link and it goes to this php page where it passes the Recid via form. Then all this page does is

gets the FileMaker Record for editing, sets the scripts and passes a parameter to the FileMaker Script and Executes.

Give it a try. If it's not working be sure to go to the Public API web site to download the latest updates. Hope this helps.

$editCommand = $fm->newEditCommand('PHP', $recid);

$editCommand->setScript('Snooze', $recid );

$editCommand->setField('Snoozefield', $nooze);

$result = $editCommand->execute();

ExitOnError($result);

Regards,

Javier

JVillalobos Consulting, San Francisco

  • 4 months later...
Posted

Two things:

1. Be sure you have downloaded and updated your FileMaker API

because the Public Beta does NOT include the version that runs scripts. Only Update 2 or 3 contained fixes for triggering scripts.

2. Your script looks correct but I think you must at least set one

field to change in the EditCommand otherwise it might return

that you didn't have any changes to make. That is you are using the EditCommand, adding the script but you are not changing

any data. If you look at my example I basically have a field on my layout that I update

but it's not critical to the solution. It also lets me see that the script worked because it updates a field in FileMaker. I tried

to email you but you don't have any email address on your record here. If you want ot email me directly my address is [email protected].

This topic is 6478 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.