This is a quick "how-to" for people new to scripting and script parameters.
Scripts are easily called from menus, buttons and script triggers. When we call a script FileMaker allows us to pass information into the script using the Script Parameter input field.
Passing a script parameter allows you to do many different things. In general, it allows you to write less code and more generic code. The first benefit of this is that you write less scripts. You don't need to write a new script for every single thing. Instead you write one script and pass the unique thing into the script using a parameter. The ultimate benefit of this is that your code is simpler, more reliable, and only in one spot ( not spread through a dozen scripts ).
Notice that the script parameter label ( in English ) says "parameter", that is, a single parameter, not "parameters". This is a feature that will get in your way at some point in time.
The script parameter is generated using calculations, even when it is only a simple text string or field value. Fortunately, we can use this to our advantage. At present, I think that the JSON functions provide the easiest way to pass multiple script parameters.
In the following image we can see a calculation which is generating a JSON string. The JSON output is a string of text and FileMaker sees this string of text as one parameter. However, the JSON functions will recognise two named items.
Inside your script you can access your script parameter using the Get(ScriptParameter) function. The next image shows one example for retrieving parameters. It uses JSON functions to set local variables. These local variables can then be used throughout the script.
Here we use the two parameters for different purposes. We passed an ID and a Name. We switch layouts and display a different table. We then search for a record using the ID. When we find the record, we set the field "parameterName" using the "name" that we passed using the second parameter.
Parameters can be used in many ways. You can use the value of parameters to fork code, using IF ( $parameter = X ) ELSE IF ( $parameter = Y ) ELSE END IF. This gives you enormous flexibility as you write your scripts.
The length of script parameters is limited. I can't find a direct reference. If someone can locate it that would be great. The FileMaker 19 Technical limits say that calculation formula are limited to 30,000 characters.