Workflow Editor use case

Learn how to automate stock expiry notifications

Malka Hoffmann avatar
Written by Malka Hoffmann
Updated over a week ago

Labguru’s workflow editor is a powerful tool that can automate any process or task performed manually within the system. Automation can be tailored to your specific needs and can be used across the system utilizing the various functions Labguru has.

Automated processes can be built to simplify data management, lab management tasks, email notification, alerts, and more.

Below we present a use case of a commonly requested automation for tracking stocks' expiry dates in advance. This automation will help you prevent inadvertent use of expired stocks which might have an effect on the reliability of your research results.

Stock expiry notification flow

Using our Workflow editor you can create an automation that will send an email notification at a frequency of your choice to alert you on stocks about to expire.

How to build this workflow?

Building a workflow starts with choosing the required trigger for the automation you wish to build, from the various triggers we have to offer:

In this case, the required trigger will be ‘Triggerless - Periodic’. After selecting this trigger we need to define the schedule for the initiation of the workflow i.e once a week, once a month, etc.

Guru Tip:

Click on the ׳crontab guru׳ link for additional timing options and its syntax.

The next step after setting up the trigger includes a scripter with a python script that searches for all stocks from the consumables collection that are about to expire in the upcoming month:

In this script, we used a ׳GET stocks׳ API endpoint and added a filter to the request to obtain only stocks from the consumables collection (filter = “stockble_type”: “Catalog”:: “Material”).

We've added ‘meta= true’ and iterated the stocks page count to get the total number of stocks in the consumables collection.

Guru Tips:
If needed, stocks can be filtered by any other collections as well.
More information regarding filtering is in our API documentation.

Once we get hold of all stocks in the consumables collection, we need to check if the expiration date of each of them is within the upcoming month and if so, to gather them all in one list.

Next, we defined which information will be sent by email using a variable called ‘text’ that contains the information on all expired stocks.

After defining the text variable and the information that should be sent to the user, we've added the ‘Send email to’ step for setting up the email notification.

The email content and the recipient should be predefined at this stage. In our case, the email content includes the ‘text’ variable we defined in the previous step.

The recipients can be indicated by typing an email address or the user's Labguru member ID.

The final outcome of this workflow is an email, sent at a predefined schedule, listing all stocks that will be expired in the upcoming month.
The stock name is also a link that will direct you to the stock’s show page.

For further information on how to use Labguru's Workflow Editor go to our workflow editor user manual.

Did this answer your question?