arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Setting a Default Next Action

Often, a protocol step will have just a single 'next action' that is required to continue the workflow. In such cases, it can be desirable to automatically set the default action of the next step.

This example script shows how this task can be achieved programmatically.

hashtag
Solution

hashtag
Step configuration

The step is configured to invoke a script that sets the default next action when you exit the Record Details screen of the step.

hashtag
Parameters

The automation command is configured to pass the following parameters to the script:

An example of the full syntax to invoke the script is as follows:

hashtag
User Interaction

When the lab scientist exits the Record Details screen, the script is invoked and the following message displays:

If the script completes successfully, the LIMS displays the default next action. If the current step is the final step of the protocol, it is instead marked as complete:

hashtag
Manual Intervention

At this point the lab scientist is able to manually intervene and reroute failed samples accordingly.

NOTE: it is not possible to prevent the user from selecting a particular next-step action. However, it is possible to add a validation script that checks the next actions that have been selected by the user against a list of valid choices.

If the selected next step is not a valid choice, you can configure the script such that it takes one of the following actions:

  • Replaces the next steps with steps that suit your business rules.

  • Issues a warning, and prevents the step from completing until the user has changed the next step according to your business rules.

hashtag
About the Code

The main method in the script is routeAnalytes(). The method in turn carries out several operations:

  1. The actions resource of the current protocol step is investigated.

  2. The possible next step(s) are identified.

  3. If there is no next step, the current step is set to 'Mark protocol as complete.'

hashtag
Assumptions and Notes

  • The attached file is placed on the LIMS server, in the /opt/gls/clarity/customextensions folder.

  • The Python API Library (glsapiutil.py) is placed on the Clarity LIMS server, in the /opt/gls/clarity/customextensions folder. You can download the latest glsapiutil library from our .

  • The example code is provided for illustrative purposes only. It does not contain sufficient exception handling for use 'as is' in a production environment.

hashtag
Attachments

setDefaultNextAction.py:

If there are multiple next steps, the first is used to set the next action.

-u

The username of the current user (Required)

-p

The password of the current user (Required)

-s

The URI of the step that launches the script (Required)

The {stepURI} token

-a

Sets the next action to a fixed value. (Optional)

This is for advanced use, for example, when you would like to set the next action to a fixed value — 'repeat step', 'remove from workflow', and so on.

GitHub pagearrow-up-right
file-download
3KB
setDefaultNextAction.py
arrow-up-right-from-squareOpen
Setting_default_next_action_message.png
Setting_default_next_action_Complete.png
/usr/bin/python /opt/gls/clarity/customextensions/setDefaultNextAction.py 
-u admin -p securepassword -s 
https://demo-5-1.claritylims.com/api/v2/steps/122-7953