Now we want to make our trigger do something. With any workflows (triggers included) the things that make stuff happen in Centerbase are called Commands.
Below I will often refer to the “main” record of a workflow/trigger. In the case of a trigger, this refers to the record that was modified / created and that fired the trigger in the first place.
There are five types of commands:
Create a new record of any item type, set fields on that record and link to the main record. The things you can setup on a Create command include:
- Item Type: The type of record you are going to create.
- Name: The name you want to give the auto-created record. This can be left blank if you have setup auto-naming or you want to set the name using fields below.
- Set lookup field: This allows you to set a lookup field on the main record to the ID of the record you are creating. Lookup fields are very valuable in workflows. They can be used in queries to see if a record exists and check values on it. They can be used in create and update commands to pull values from other records besides the main record. They can be used for a variety of email and document merge operations. And much more.
- Link to the [main record]: When checked, this will link the newly created record to the main record
- Fields to set: Here you can set various fields on the newly created record. You can set as many field values as you would like by clicking the Add Field button. To remove a field value, simply click the X button on the far right of that field. You can set the values of the field(s) to:
- Text Value: simply puts the typed in value into the field. Can be used for any type of field. If used on a lookup field, you’ll need to specify the full ID of the record you want to set.
- Current User: Only applies to User Lookup fields. Sets the user who triggered this action to be set in the given user lookup field.
- Current date/time: Can be used with date or date with time fields. Simply puts the current date or date/time in that field. Very useful for noting when certain triggers/workflow steps happened. This is also a great way to ensure a workflow/trigger action doesn’t infinitely repeat. You can specify in a query that an action should only occur if the given date field is empty. Then once the action has occurred, set the current date in that field to both ensure it doesn’t happen again and note when it happened.
- Values from the main record or any of its lookup fields: This allows you to copy values from another record. You can copy a value from any of the fields on the main record or from any record that is connected to the main record through a lookup field.
Update the current record or any record available through a lookup on the current matter. The setup is very similar to the Create command. First you choose what you want to update. It can either be the main record (the one that the trigger fired for) or any record connected to it through a lookup field
Then you simply choose the fields / values you want to set in the same manner as a create command
Send an email using a pre-defined template from an email address to one or more recipients.
First select an e-mail template to use. This can be created on the PC version under Reports -> HTML Editor. It can be a generic e-mail template or have merge fields for the type of record the trigger is associated with. For instance, if this was a Matter trigger, you could have fields on it related to the matter, it’s client, etc., but you could not use a template designed for Bills.
Next you must choose the From/Sender address and at least one To/Recipient address. You can set these up in a few ways. We will soon be releasing some ease of use updates to this section to make it easier to setup sender and recipient addresses:
- Text: Simply enter an e-mail address and a display name (optional) for the sender/recipient.
- Main Record: Let’s you send the e-mail to/from the main record. You will need to enter which e-mail address field it will use (such as work e-mail or personal e-mail).
- Lookup: Send the e-mail To/From a record that is connected to the main record through a lookup field. First you will set what lookup field to use. For instance, if you want the e-mail to look like it was from the Lead Attorney on a matter, pick the Lead Attorney lookup field for the From address. You will also specify what e-mail address field to use.
- Linked Objects: Only valid on To recipients. This function lets you send an e-mail to all the given records linked to the main record. For instance, if an Event has 20 contacts linked to it that attended, you can set this up to send to all of them. Just specify what type of linked records to send to and what e-mail address field to use.
- Object: If you want to specify a specific record to send to/from, you can enter the ID of the object and the e-mail address field to use.
Generate a document from a pre-defined template, set a lookup to the new document and link said document to the main record. All you need to do is choose a Word Merge Template to use (this can be setup using the Centerbase Word Add-in). You can also choose a lookup field to set and whether to link it to the main record.
Run custom code (created by Centerbase) to execute advanced functionality. This is currently only used by Centerbase. It allows us to run a completely custom bit of code from a DLL.