Tech Tip: Editing Tokens in Laserfiche Workflow
By: Sarah Seene
If workflows are the engines that drive successful business processes, tokens are the bolts that hold the engine together. Tokens provide up-to-date information every time a workflow runs, including the most recent information from your Laserfiche repositories.
In their most basic form, tokens are placeholders that Laserfiche Workflow replaces with current and relevant information each time a workflow runs. Editing a token can format that information and can even return information about the token value itself.
For example, the %(Date) token returns the current month, day, and year. However, if a workflow requires only the current month, token editing can change the date token to be replaced with only the month. Alternatively, a multi-value token might return a list of people who approved a document, but, if needed, the token can be modified to return the number of people in the list instead.
The following four token editing options can be used individually or in combination:
- Indexing: Multi-value tokens are comprised of a list of values, and indexing lets you specify which value in the list to display. For example, if a workflow needs to contact the last person who added their name to the “Approvers” field, the corresponding token can be modified so it is only replaced by its last value. Or, as shown in the screenshot below, you could return the second person who signed the document.
- Formatting: This option allows .NET formatting expressions to be applied to tokens. For example, these expressions can make tokens conform to a specific date format, display a specific number of digits, or reflect the local currency.
- Regular Expressions: Regular expressions identify a pattern and extract information based on that pattern. For example, you can use a regular expression to modify an “Address” token so it will only be replaced by the zip code instead of the entire address.
- Functions: Workflow has a wide variety of functions that can do everything from converting a token value to title case to encoding XML in a token value. Many of the functions apply to multi-value tokens, such as finding the largest value in the token, removing duplicates, sorting the values, and summing the values. In the screenshot below, both the “Tot Tile Case” and “Remove Duplicates” functions have been applied to a list of signatures.
To edit a token
- In the Workflow Designer, right-click the token you want to edit.
- Select Token Editor.
- In the Token Editor, select Apply Functions, Apply Index, Apply Formatting, and/or Apply Regular Expression.
- Configure each option as desired. More info.
- Click OK to apply the edits.
To learn more about tokens, see the Tokens in Workflow white paper on the Laserfiche Support Site.