For the above emergency situation where the impact is 'High', the required 'Action' can be triggered through the script/class file.
The members of the E-CAB can be configured well in advance for such emergency situations and the corresponding class/script file can be executed. To perform actions, it is necessary to have the Class file in the specified location for the action implementation.
In case of 'class' file:
*By default, jar should be placed in [SDP_Home]/integration/lib/ directory
*Example:com.servicedeskplus.integration.ChangeActionImplementation
Note: It is necessary that the class file has to converted to jar file to implement the action.

Let us consider the situation where the roles performed by the E-CAB members have to be updated. The following JSON format has to be followed inorder to trigger the required action.
UPDATE_ROLES (Script/Class)
{
"message": "Adding Emergency CAB members through Custom Trigger",
"operations": [
{
"operation_name": "UPDATE_ROLES",
"input_data": {
"change": {
"roles": [
{
"id": 5,
"name": "Line Manager",
"users": [
{
"email": "Aaron@xyz.com",
"name": "Aaron"
},
{
"email": "Abby@xyz.com",
"name": "Shawn Adams"
}
]
}
]
}
}
}
]
}
Following is a sample implementation for 'Change' Action :
package com.servicedeskplus.integration;
import com.manageengine.servicedesk.actionplugin.executor.ActionInterface
import com.manageengine.servicedesk.actionplugin.executor.ExecutorData
/**
*Trigger implementation has to be done in this class
*@executorData, contains DataJSON,diffJSON
*/
public class ChangeActionImplementation extends DefaultActionInterface {
public JSONObject execute(ExecutorData executorData) throws Exception {
//get the change data in api format
JSONObject changeData = executorData.getDataJSON();
//fetch the field impact
JSONObject impact = changeData.get("impact");
//get the value associated with impact
String impactName = impact.get("name");
JSONObject returnJSON = new JSONObject();
//Array of operations to be performed in trigger ,currently UPDATE_ROLES option is alone provided in change
JSONArray operations = new JSONArray();
//JSON for specific operation
JSONObject operation = new JSONObject();
//JSON for providing operation details
JSONObject input_data = new JSONObject();
//JSON for entity change
JSONObject change = new JSONObject();
//Array of roles to be configured
JSONArray roles = new JSONArray();
//JSONObject for Role details
JSONObject roleObject = new JSONObject();
//array of users to be configured
JSAONArray users = new JSONArray();
//JSONObject for user details
JSONObject user1 = new JSONObject();
JSONObject user2 = new JSONObject();
if (impactName.equalsIgnoreCase("High") {
returnJSON.put("message", "Adding Emergency CAB members through Trigger");
operation.put("operation_name", "UPDATE_ROLES");
roleObject.put('id': ROLEID of CAB);
roleObject.put("name": "Role Name ,Here CAB");
user1.put("email": "emailId of user");
user1.put("name": "name of user");
user2.put("id": ID of user);
// Enter the name of the user.
user2.put("name": "name of user");
users.put(user1);
users.put(user2);
roleObject.put("users", users);
roles.put(roleObject);
change.put("roles", roles);
input_data.put("change", change);
operation.put("input_data", input_data);
operations.put(operation);
returnJSON.put("operations", operation);
} else {
returnJSON.put("message", "Adding CAB members through Trigger");
operation.put("operation_name", "UPDATE_ROLES");
roleObject.put("id ": ROLEID of CAB);
roleObject.put("name": "Role Name, Here CAB ");
user1.put("email": "emailId of user");
user1.put("name": "name of user");
user2.put("id": ID of user);
user2.put("name": "name of user");
users.put(user1);
users.put(user2);
roleObject.put("users", users);
roles.put(roleObject);
change.put("roles", roles);
input_data.put("change", change);
operation.put("input_data", input_data);
operations.put(operation);
returnJSON.put("operations", operation);
}
return returnJSON;
}
Following are the methods used in Class implementation:
*getDataJSON()- To get the input in API format which provides complete information about the 'change'.
*getDiffJSON()- Returns the details iof the fields that are modified recently in the change To get information about the recently modified fields in the 'change'.
Click here to view the values returned in getDataJSON() and getDiffJSON()
Having known the JSON format , the action can be executed either via class file or script file. To perform actions, it is necessary to have the Script file in the specified location for the action implementation.
In case of 'script' file:
*By default, scripts should be placed in [SDP_Home]/integration/custom_scripts/ directory
*Example: py addApprovers.py

Click here to view a sample script file for 'Change' Action: