From time to time, you may encounter scenarios in which you need to create a frontend for initiating a service, often to be used by non-technical individuals. Both FX and K8X offer the capability to define forms using a straightforward JSON structure.
These forms are automatically generated by the Ferris Management UI, based on the ‘parameters.json’ file.
When a service directory includes a ‘parameters.json’ file, the ‘Run’ button in the Management UI will automatically change its icon to a ‘Form’ icon.
To add the ‘parameters.json’ file to an existing service directory, ensure that the ‘allow_manual_triggering’ in the manifest.json file is set to ’true.’
Template parameters.json file
The ‘parameters.json’ file contains a JSON definition of fields. These fields are presented to the user when manually triggering a package execution to collect the parameter values needed to run the package. This approach allows the same package to be easily adapted and reused for different scenarios or environments simply by providing different parameter values to the same package.
The provided template will display a form as follows:
When users enter values in the form and click the ‘Run’ button, the form parameters and values will be sent to the service upon triggering. These parameters will be available to the service as if it were triggered by an event with the same payload as the form values.
Below is a sample script that extracts the parameters (notice that it’s not fundamentally different from a script triggered by an event). The only exception is the text areas, which are treated as String data types and may require conversion using the appropriate JSON library.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.