Differenze tra le versioni di "Action engine"

Da itm wiki.
(Services)
(Services)
Riga 229: Riga 229:
  
 
  /**
 
  /**
  * invoke EntityFinderService for all supported entities and print result as PSM warnings
+
  * invoke EntityFinderService for all supported entities and print result as PMSM warnings
 
  * @param event
 
  * @param event
 
  * @param incomeParameters
 
  * @param incomeParameters

Versione delle 09:30, 6 nov 2017

Action Engine Configuration

Action Engine enabled the user to configured an Action and the activation condition. An action is composed by:

  • General Information
  • Trigger and Activation condition
  • Parameters
  • Tasks to execute

General

The following images shown the action' user interface and provide some more detail about this functionality

Action Configuration

Parameters

TBC

Events Managed

Category / Class General Project Service Ticket
LDAP Events LDAP Message N/A N/A N/A
MB Scheduler Reporting distribution by mail

Resource on project association

Upload relations Resource-Projects

N/A N/A N/A
User Note Events User Note Created

User Note Updated

N/A N/A N/A
Internal System Events N/A Project Created

Project Updated

Service Created

Service Updated

Ticket Activity Created

Ticket Activity Updated

Ticket Created

Ticket Updated

Workflow Button

External System Events N/A N/A N/A Incoming Message
OCE Events N/A N/A N/A Trigger Value Reached
Company Events Process File Upload N/A N/A N/A
LDAP Message

This event is raised when MB sends an itmSUITE internal Message to PMSM with type "Ldap Synchronization".

Reporting distribution by mail

This is an External Event, it is raised when MB sends an itmSUITE internal Message to PMSM with type "Reporting distribution by Mail".

Resource on project association

This is an External Event, it is raised when MB sends an itmSUITE internal Message to PMSM with type "Resource on Project Associations".

Upload relations Resource-Projects

This is an External Event, it is raised when MB sends an itmSUITE internal Message to PMSM with type "Upload relations Resources-Projects".

User Note Created

This is an Internal Event: it is raised when a User Note is created on Ticket.

User Note Updated

This is an Internal Event: it is raised when a User Note is updated on Ticket.

Project Created

This is an Internal Event: it is raised when a Project is created.

Project Updated

This is an Internal Event: it is raised when a Project is updated.

Service Created

This is an Internal Event: it is raised when a Service is created.

Service Updated

This is an Internal Event: it is raised when a Service is updated.

Ticket Activity Created

This is an Internal Event: it is raised when a Ticket Activity is created.

Ticket Activity Updated

This is an Internal Event: it is raised when a Ticket Activity is updated.

Ticket Created

This is an Internal Event: it is raised when a Ticket is created.

Ticket Updated

This is an Internal Event: it is raised when a Ticket is updated.

Workflow Button

This is an Internal Event: it is raised when a Custom Field with type "Command button" on a Ticket is pressed.

Incoming Message

This is an External Event.

When the incoming message is validated by EEM, the informations are sent to MB (Message Bus) that dispatch it to the itmSUITE® Action engine and a configured Action is activated.

Trigger Value Reched

This is an Internal Event: it is raised when a OCE Objective reach a trigger.

VCE Condition

Condition'tab enable the user to define a Boolean condition that should be verify before activate the action' . Generally the conditions works on input Parameter.

Action Configuration

Task

Tasks tab enable the user to define one or more task that will be executed sequentially if the condition is valid. The system manage different type of task, the most flexible and powerful is Scripting task, based on Javascript framework, enable the user to call itmSUITE® primitive

Action Task Configuration

Basic Task

TBC

Scripting Task

Scripting Task in a JavaScript editor: it allows to use many methods to perform a large set of operations on itmSUITE entities (Ticket, Service, CI etc...)

Action Engine can also send information towards third parties software using scripting tasks. This can be performed:

  • Sending a preformatted mail
  • Calling a third parties web services
Action Task Configuration

Scripting Task Tutorial

Simple Event Handler

We need to define a function main, which accept two arguments:

* event
* incomeParameters
Empty Task Handler
/**
* @param event
* @param incomeParameters
*/
function main(event, incomeParameters)
{
}
incomeParameters usage
/**
* 1. print as warning event name and Task Income Parameters
* 2. accessing to income parameter by name
* @param event
* @param incomeParameters
*/
function main(event, incomeParameters)
{
var message = " event: " + event.getClass().getSimpleName();
var entries = incomeParameters.entrySet().toArray();
for each (var obj in entries)
{
message = message
+ "\n"
+ "key:" + obj.getKey() + "\n"
+ "value:" + (obj.getValue().getValue() != null ? obj.getValue().getValue() : "null");
}
//suppose we have parameter under "ticket" name
//lets retrieve it
var value = incomeParameters.getObjectValue("ticket");
message = message
+ "\n"
+ "ticket:" + value;
//lets retrieve type of incomeParameters.getObjectValue("ticket")
var type = incomeParameters.getParameterTypeModel("ticket");
message = message
+ "\n"
+ "ticket:" + type.getName();
taskRuntime.addWarning(message);
}
taskRuntime

taskRuntime Provide access to:

* securityContext
* entities and system services 
* system logger
* to user messages (warnings and errors messages)
/**
* print as warning resource full name and event name and dump the same 
* message as error and warning to system log
* @param event
* @param incomeParameters
*/
function main(event, incomeParameters)
{
var message = "user:" + taskRuntime.getSecurityContext().getResourceFullName()
+ " event: " + event.getClass().getSimpleName();
taskRuntime.addWarning(message);
taskRuntime.getLogger().error(message);
taskRuntime.getLogger().warn(message);
}
Services

SystemService - provide access to PMSM's email internal service

/**
* send an email to myEmail@host.com
* @param event
* @param incomeParameters
*/
function main(event, incomeParameters)
{
var systemService = taskRuntime.getService("SystemService");
var eventName = event.getClass().getSimpleName();
systemService.sendEmail("myEmail@host.com", "email send by scripting task:" + eventName, "TBD");
}

EntityFinderService - provide a set of finders for different entities

/**
* invoke EntityFinderService for all supported entities and print result as PMSM warnings
* @param event
* @param incomeParameters
*/
function main(event, incomeParameters)
{
invokeEntityFinderService("Area", "test");
invokeEntityFinderService("Functionality", "test");
invokeEntityFinderService("Product", "test");
invokeEntityFinderService("Project", "test");
invokeEntityFinderService("Resource", "test");
invokeEntityFinderService("ResolutionCause", "test");
invokeEntityFinderService("Service", "test");
invokeEntityFinderService("SolutionGroup", "test");
invokeEntityFinderService("TargetEnvironment", "test");
invokeEntityFinderService("TicketAdmStatus", "enumeration.ticketadminstatus.unbillable");
invokeEntityFinderService("TicketArea", "test");
invokeEntityFinderService("TicketCategory", "test");
invokeEntityFinderService("TicketImpact", "test");
invokeEntityFinderService("TicketTopic", "test");
invokeEntityFinderService("TicketUrgency", "test");
invokeEntityFinderService("TicketActivityStatus", "enumeration.ticketactivity.running");
}
function invokeEntityFinderService(entityName, name)
{
var service = taskRuntime.getService("EntityFinderService");
taskRuntime.addWarning("entityName:" + entityName+ " name:" + name+ " id:" + 
service.findIdByName entityName, name));
taskRuntime.addWarning("entityName:" + entityName + " name:" + name + " model:" +
service.findModelByName(entityName, name));
taskRuntime.addWarning("entityName:" + entityName + " name:" + name + " entity:" +
service.findEntityByName(entityName, name));
}