Server Administration > Automate Tasks and Calculate Data Using Event Triggers > Creating Workflow and Document Event Triggers > Creating Rule Based Change Triggers > To create a rule-based change trigger in the GUI
To create a rule-based change trigger in the GUI
1. In the Triggers view, select Trigger > Create. The Create Trigger dialog box displays the Type panel.
2. In the Name field, type a name for the new event trigger.
3. Select Rule.
4. To enter a description for the event trigger (optional), click the Description tab. The Description panel displays.
5. Type a description in the field.
6. To define a rule for the event trigger, click the Rule tab. The Rule panel displays.
If no rule is defined for a rule-based change trigger, the trigger runs every time any user performs an action on any item in Windchill RV&S.
a. If certain conditions are met, nodes specify if the trigger runs. Select a node option by clicking a button:
And specifies that all of the conditions specified must be true for the trigger to run. For example, if an item’s assigned group=documentation and the project=editor, then the event trigger runs.
Or specifies that one or more of the conditions must be true for the trigger to run. For example, if an item’s state=submitted or the priority is not equal to high, then the event trigger runs.
Swap replaces the selected node with the opposite node. For example, swapping an Or node replaces it with an And node.
Remove deletes the selected node.
You do not need to use And and Or nodes if your rule contains only one condition.
b. Under Condition, define the conditions this trigger should run under. For more information, see “Defining Rules”.
For example, in a workflow with the states Development > Testing > Release, you can create a rule-based trigger to perform an action whenever an item is changed to the Testing state (State=Testing). Another example is to perform an action every time the assigned user of an item is changed to the specified user, such as in the following example:
Assigned User<>Assigned User
Assigned User=mchang
Using the same workflow of Development > Testing > Release, you could create a rule-based trigger to perform an action for all items existing in the Testing state (State=Testing). Another example is to perform an action for all items that are currently assigned to the specified user (such as, Assigned User=mchang).
c. To add the condition to the rule, click Add. To replace an existing rule with a new rule, select the rule in the rules list, then click Replace.
d. To copy a rule from another trigger, under Copy do one of the following:
Click Add to copy notification conditions. The copied conditions are appended to any existing rules.
Click Replace to copy notification conditions and replace any existing rules.
The Rule Selection dialog box displays.
e. In the Objects with Rules list, select the trigger you want to copy a rule from. If the trigger has a rule, that trigger displays in the Preview area.
Click OK. The rule displays in the Rule panel.
Repeat as necessary to copy other rules.
7. To select scripts for the new trigger, click the Trigger tab. The Trigger panel displays.
a. To specify the script file or files the event trigger runs when scheduled, do one of the following:
In the Script File field, enter the name of the JavaScript™ file. For more than one file, place a comma between file names.
Click Browse, select a script file from the list in the viewer, and click OK. Selected scripts display in the Trigger panel.
Press CTRL to multi-select scripts or clear a selection. Multi-selected scripts appear in the Script field on the Triggers panel delimited by commas.
b. If the trigger is a pre- or post-event, or both, enable the option or options accordingly.
c. Enter trigger parameters, if any, in the relevant Parameters fields. Point to the field name to view a tooltip containing more information about the parameter.
Backlashes (\) in parameters are truncated after you save and run the trigger, for example, in a directory path. To avoid this, use forward slashes (/).
8. To assign values to specific fields when the event trigger is run, click the Assignment tab. Depending on the scripts they run, some triggers may not require assignments (for example, if the assignments are coded in the scripts). The Assignment panel displays.
You can create a list of assignments that occur when the rule matches by specifying a field and the value the trigger enters in that field when it runs. Standard fields, which are not writable (such as ID, Type, Created Date, Created By, Modified Date, and Modified By) and item backed picklist fields with rule-based relationships are not available for assignments.
A field can only have one assignment. The last assignment you add to the Assignment panel is the one that the Windchill RV&S server uses. Configuration management project fields cannot be assigned.
When you select the Assigned User or Assigned Group fields, you can click the Select button to choose from a full list of users or groups, including inactive ones.
a. From the Field list, select the field name.
b. From the Value list, select a value for the selected field.
c. To add the assignment to the list, click Add.
Repeat steps a) and b) for additional assignments. To replace an assignment with a new one, in the list select the assignment to be replaced, and click Replace.
d. To remove an assignment, select the assignment in the list, and click Delete.
Assignments made on the Assignments panel occur after any assignments made by code in the script file are performed.
9. To set the trigger, click OK.