We used to suggest scripts like the one below to install the MBS FileMaker Plugin and check for the error status. But the following script has a big problem, a little oversight on how FileMaker works. Try to guess what is wrong here:
Install Plug-In File [ Install Plugin Update if needed::Plugin File Mac ]
Set Variable [ $LastError ; Value: Get(LastError) ]
Set Variable [ $LastErrorDetail ; Value: Get(LastErrorDetail) ]
The script installs the plugin and in case of an error, we like to query the error code and message. But this script never gets the last error detail! You may guess that we query the last error number and detail for the first line with the installation. But what we do is to query the detail for LastErrorDetail, we get the result from the Set Variable script line in the second line. Yes, the Set Variable will clear the error state and thus we never get the detail for the first line.
We have a fixed script:
Install Plug-In File [ Install Plugin Update if needed::Plugin File Mac ]
Set Variable [ $r ; Value: Let([
$lastError = Get(LastError);
$lastErrorMessage = Get(LastErrorDetail)
]; 1) ]
This time we use a Let() statement to query both LastError and LastErrorDetail and assign it to variables. This way the Set Variable can overwrite the error state after we got the values.
If you have existing scripts using Get(LastErrorDetail), you may want to update them to use a Let statement.