Adding triggers
You can add triggers to initiate actions based on events that users perform on files. Before you add a trigger, take the time to define the following:
- The event or activity that causes the trigger to fire
- The criteria (preconditions) the trigger will use to select the files that initiate the action
- The action the trigger performs
1. Choose Tools > Administration > Triggers.
The Triggers dialog box opens.
2. Click Add.
The Add Trigger dialog box opens.
3. Enter a Trigger Name.
4. On the Trigger When tab, select the events that cause the trigger to run.
- Select Perform trigger before event occurs or Perform trigger after event occurs to indicate when you want the trigger to run. Pre-event triggers are only available if the when the file version is updated, when the file is created, or on an event option is selected.
- Select the event that causes the trigger to run. If an event requires you to select a value, the Trigger When dialog box opens. Select a value and click OK. The value is displayed in the events list and Summary field. Double-click a value in brackets to change it.
5. Click the Preconditions tab to set the condition that files must meet to run the trigger.
6. Select a precondition.
The Precondition dialog box opens. You can add preconditions based on branch and repository, filename, committed changelists, workflow states, users performing file events, security groups for users performing file events, or custom field values.
7. Enter or select the precondition values.
Preconditions have the same fields used in filter, advanced find, and report restrictions. See Adding restrictions.
8. Click OK.
The precondition values are added. The values are displayed in the conditions list and the Summary field.
9. Repeat steps 6-8 to select any additional preconditions. To change a precondition value, double-click the value in the list.
When you add more than one precondition, Surround SCM treats them as ‘and’ conditions. Triggers only fire when all of the selected preconditions are met.
10. Click the Actions tab to select the actions that occur when the trigger runs.
- Click Add to add an action. See Adding trigger actions.
- Select an action and click Edit to change it. See Editing trigger actions.
- Select an action and click Top, Move Up, Move Down, or Bottom to change the action order.
- Select an action and click Delete to delete it. See Deleting trigger actions.
11. Select Disable trigger after it runs once if you only want the trigger to run once.
12. Click OK to add the trigger.