Assign Documents to Users Randomly with Laserfiche Workflow
Contributed by: Michael Wells, System Administrator, Chesterfield County, VA
With the holiday season rolling around, many organizations and departments have an annual Secret Santa tradition. With dozens of people participating, such a process can include a lot of coordination. To demonstrate the capabilities of Laserfiche at a recent user group meeting, I automated the whole gift assigning process with Laserfiche Forms and Laserfiche Workflow.
The process in a nutshell
The Secret Santa process at Chesterfield County works as follows:
- Every employee who wishes to participate submits a Laserfiche Form that asks for their gift preferences.

- Once all participants have submitted the questionnaires, the Secret Santa coordinator starts a Laserfiche Workflow business process that randomly assigns a participant to each list.
- Each participant is notified by email of the person that they are assigned to purchase a gift for.

- Once the gift is purchased, the responsible person changes the value of the metadata field and the business process ends.

- If the gift isn’t purchased in five days, the giver gets reminded by email.

What’s going on behind the scenes
There are actually three separate Laserfiche Workflow business processes that run behind the scenes.
Workflow 1
This Laserfiche Workflow business process does the following:
- Creates tokens that will be used to assign random gift givers to gift recipients. These tokens are used in the script later on in the workflow.
- Finds all submissions without any giver assigned.
- Uses a special Flag field to make sure that no one is assigned to purchase a gift for himself.
- Generates a random number using an SDK Script. This number is used to match the recipient to the giver.
- Populates the submission’s metadata fields with the name of the assigned giver.
Here is what the script looks like. The tokens “maxrandom” and “randomnumber” must be created first with the Create Tokens activity.

Here is what the whole workflow looks like:

Workflow 2
Once all of the givers are assigned, this Laserfiche Workflow business process iterates through each submission and launches the third workflow, described below.

Workflow 3
This workflow is responsible for the various notifications. First, it routes the submission to a brand new folder and then assigns Browse, Read and Write Metadata rights to the submission for the giver. It also emails the link to the submission to the giver. If the giver doesn’t purchase a gift within five days, the workflow sends another email notification.
Here is what this workflow looks like:

Some things to keep in mind
Here are some things to keep in mind when setting up this process:
- Users participating in the Secret Santa exchange should have accounts in Laserfiche already or permissions configured through Windows groups. Laserfiche will assign the security to the folders it creates as necessary.
- To make the process less confusing to the user, the two fields used by Laserfiche Workflow, Doc Assigned and Flag, can be hidden from everyone but the Workflow user. Since users can only edit one field, they will know exactly what action they have to perform.
