Change Custom Triggers
Change custom triggers allow you to execute custom scripts or files and automate change-related tasks. In custom triggers, you will define rules, which when match the change requests will invoke predefined actions. Triggers prove specially useful in performing actions in other modules or in third-party applications.
Some actions that you can perform with change custom triggers are changing roles assignment after updating a change, approving a change based on the percentage of CAB recommendations, resolving associated problem(s) and incident(s) when a change is closed, closing task(s) on canceling/completing a change request and more.
Configuring a New Action Using a Custom Trigger
Click Admin>Problem/Change management>Change Custom Triggers.
Click Add New Action and provide a unique name and description to the action.
Select from the following when the action has to be executed:
-
Change is created
-
Change is edited
-
Change is created and edited
-
CAB members take an approval action
-
CAB members recommend a change
-
CAB members reject a change
Setting Matching Conditions
You can set conditions to be matched by the change for executing the custom script.
Select the criteria fields and set corresponding conditions and field values as displayed in the following screenshots.
Click the Add icon or Add another criteria to specify more matching conditions. Switch between AND and OR operators between the conditions per your requirement.
Configuring Action
Select the Action Type and the corresponding script/class file/custom function that has to be triggered.
For Execute Script/Class action type, specify the file name in the field provided. Click here to view a sample custom script configuration.
Arguments for Custom Script can also be passed.
Eg: cmd / c Index.bat $SUBJECT $PRIORITY $STATUS
Other Parameters Supported
$COMPLETE_JSON_FILE ---> Complete Request Object will be saved to a JSON file and the file path will be passed as String Object. If the Operation is 'When a Change is edited', then DIFF_JSON (difference between the old change data and new change data) will also be saved to a JSON file.
JSON File Path : (SDP MSP_Home\integration\custom_scripts\change\12_1426143538036.json).
Here's a list of more parameters supported.
Using custom function execution, you can manipulate data in ServiceDesk Plus MSP and other external applications. requestObj and context are the arguments supported in custom functions.
Choose the required custom function or add a new one.
To learn how to write a custom function, visit this page. Also, here are the use cases for custom functions.
Stopping Subsequent Actions
Select whether the subsequent custom triggers with the matching conditions for the change must be stopped from being executed on the change.
Click Save.
Sample action
List view page action
You can prioritize the custom triggers by ordering them in the list view page.
Click Organize Actions at the upper-right corner, rearrange the custom triggers using respective buttons, and click Save.
Click here to view sample scenarios for 'custom triggers' with sample class file and script.
We can also pass arguments for Custom Script. All API parameters are supported as arguments and the below table lists the supported arguments.
PARAMETER |
DESCRIPTION |
$TITLE |
Denotes the title of the change |
$DESCRIPTION |
Provides the description provided for the change |
$TEMPLATE |
Denotes the name of the template used to create the change |
$SUBCATEGORY |
Denotes the subcategory configured for the particular change |
$CATEGORY |
Denotes the category configured for the particular change |
$ITEM |
Denotes the item configured for the particular change |
$SITE |
Denotes the site for which the change was raised |
$ACCOUNT |
Denotes the account for which the change was raised |
$TYPE |
denotes the significance of a change initiated in the organization |
$SCHEDULED_START_ON |
Provides the scheduled start time of the change |
$ASSETS |
Provides the assets related to the particular change |
$ROLES |
Denotes the access permissions defined exclusively for the change |
$REASON_FOR_CHANGE |
Denotes the purpose of initiating a change request |
$URGENCY |
Denotes the level of urgency of the change |
$IMPACT |
Provides the impact of the change |
$GROUP |
Denotes the group under which the change falls |
$ISOVERDUE |
Denotes if the change is overdue |
$SERVICES_AFFECTED |
Denotes the services affected because of the change |
$COMPLETED_ON |
Provides the completed time of the change |
$RISK |
Denotes the level of risk during the implementation of the change |
$SCHEDULED__END_ON |
Provides the scheduled end time of the change |
$STATE |
Denotes the stage and status of the change |
$ID |
Provides the unique id generated for the change |
$PRIORITY |
Denotes the level of priority of the change |
$CUSTOM_FIELDS |
Provides information about the custom fields configured for the change |