CLI Reference > Server Administration Commands > im createtrigger
  
im createtrigger
creates an event trigger
Synopsis
im createtrigger [--name=name] [--type=[scheduled|rule|timeentry|copytree|branch|label|testresult|lock|unlock]] [--runAs=user] [--query=[user:]query] [--position=<number>|first|last|before:<name>|after:<name>] [--description=value] [--frequency=[manual|hourly|daily|monthly]] [--script=filename] [--scriptParams=[arg=value[;arg2=value2...]]] [--scriptTiming=pre|post|pre,post|none] [--assign=[field=value[;field2=value2...]]] [--rule=value] [--copyRule=trigger] [--ruleFile=filename] [--hostname=server] [--user=value] [--password=password] [--port=number] [(-?|--usage)] [(-F file|--selectionFile=file)] [(-N|--no)] [(-Y|--yes)] [--[no]batch] [--cwd=directory] [--forceConfirm=[yes|no]] [--quiet] [-g|--gui] [--settingsUI=[gui|default]] [--status=[none|gui|default]]
Description
im createtrigger creates an event trigger for workflows and documents. An event trigger for workflows and documents contains a list of script files that Windchill RV&S runs based on either a defined rule, or a scheduled query. Event triggers must reside on the server machine, where the Windchill RV&S Server executes them. Windchill RV&S does not support client-side event triggers for workflows and documents. As a result, all references must be relative to the server. For more information on Windchill RV&S event triggers, see the Windchill RV&S Help Center. For example:
im createtrigger --type=scheduled --name=sendmail --script=javamail.js --runAs=jriley --query=UrgentDefects
creates the scheduled trigger sendmail, using the javamail.js script and UrgentDefects query.
Options
This command takes the universal options available to all im commands, as well as some general options. See the options reference page for descriptions.
--name=name
specifies the name of the trigger. May be a maximum of 100 characters and cannot contain square brackets. This option is mandatory.
--type=[scheduled|rule|timeentry|copytree|branch|label|testresult|lock|unlock]
specifies the type of trigger. If you do not specify a type, rule is specified by default. If you specify timeentry, the values for --rule, --ruleFile, --runAs, --frequency, --assign, and --query are ignored.
* 
Scheduled event triggers are evaluated on the Windchill RV&S Server’s time zone.
--runAs=user
specifies the user for a scheduled trigger. All modifications appear as though they were made by the specified user.
--query=[user:]query
specifies the name of the query and to use for a scheduled trigger, and the username of the user who created the query.
--position=<number>|first|last|before:<name>|after:<name>
specifies the position of trigger in the run order.
--description=value
specifies description of what the trigger does.
--frequency=[manual|hourly|daily|monthly]
specifies the frequency of a scheduled trigger. By default, manual is specified. May be the following:
[manual]
[hourly [start=[00:]mm] [hours=00,01,...,23]]
[daily [start=hh:mm] [days=mon,tue,...]]
[monthly [start=hh:mm] [day=1-31] [months=jan,feb,...]]
--script=filename
specifies the filename of the script, for example, scriptfile.js. The script must be located in the following directory: <installdir>/data/triggers/scripts.
--scriptParams=[arg=value[;arg2=value2...]]
specifies the list of script arguments.
--scriptTiming=[pre|post|pre,post|none]
specifies if the script should be run pre, post, both pre and post on issue commit to the database, or no timing is associated with the script. If you do not specify an option, none is specified by default.
--assign=[field=value[;field2=value2...]]
specifies the list of field assignments.
--rule=<rule>
specifies the rule to associate with the trigger. For the rule syntax, see Specifying Rules on the options reference page.
* 
To specify a date and time for a date field, use the MM/dd/yyyy h:mm:ss [AM|PM] format. You can specify a time only if the date field is configured to display the time. To specify the current date and a time of 00:00:00 (midnight) for a date field, type today. This option can be specified only if the date field is configured to display the date. To specify the current date and time for a date field, type now. This option can be specified only if the date field is configured to display the date and time. To specify an empty value for the date field, type none.
When specifying a user, you can choose yourself by specifying "me". "me" is a symbolic user which refers to the currently logged in user. For example, you could create an event trigger that specifies Project issues can only be edited if the currently logged in user is one of the users defined in the multi-valued Stakeholders field.
Configuration management project fields are invalid in event trigger rules.
--copyRule=trigger
copies the given trigger's rule as it exists at the time of the copy. This does not create a pointer to another rule.
--ruleFile=filename
specifies a file containing the rule text. See --rule for notes on the command use and where to obtain file format information.
See Also
Commands: im copytrigger, im edittrigger, im viewtrigger, im runtrigger, im deletetrigger, im triggers, im echo
Miscellaneous: options