Validating Process/Step Level UDFs
Last updated
Last updated
In this example, the protocol step is configured to invoke a script that is triggered when the user exits the step's Record Details screen.
The EPP command is configured to pass the following parameters to the script:
An example of the full syntax to invoke the script is as follows:
When the lab scientist attempts to exit the Record Details screen, the script is invoked and the UDF names specified in the -f parameter will be checked to see that they have been populated. If they ALL have been, the script issues no message, and the process will continue as normal. If however, SOME of the UDFs have not been populated, a message will be displayed to the user indicating which mandatory fields need to be populated, and the user will be unable to move forward until all the specified fields have been populated.
The method of central interest in the script is checkFields(). The method in turn carries out several operations:
The list of fields passed to the script via the -f parameter is broken into its component UDF names
For each UDF name in the list, the corresponding value is checked via the API, and if the value is empty, the UDF name is noted as absent
If any UDF names are noted as being absent, an error dialog will be displayed to the user.
Both of the attached files are placed on the LIMS server, in the /opt/gls/clarity/customextensions folder.
The HOSTNAME global variable needs to be updated so that it points to your Clarity LIMS server.
The example code is provided for illustrative purposes only. It does not contain sufficient exception handling for use 'as is' in a production environment.
If required, this script could be enhanced so that it not only checked to see that the UDFs had been populated, but that their values also matches a regexp pattern for additional validation.
checkprocessFields.py:
-l
The limsid of the process invoking the script (Required)
-u
The username of the current user (Required)
-p
The password of the current user (Required)
-f
The names(s) of the UDF(s) that should be considered mandatory
Multiple UDF names should be separated by a comma