> For the complete documentation index, see [llms.txt](https://docs.smt-x.com/smtx-online-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.smt-x.com/smtx-online-documentation/fulfillment-platform/event-triggers.md).

# Event triggers

Event triggers allow you to start a webservice or javascript, when an event happens in SSP / Pergapedia.

## List of events

The list of events is changed continuously, and covers various topics:

* Person
  * Person impersonated
* Service
  * Business unit added
  * Business unit removed
  * Created
  * Custom request completed
  * Name changed
  * Part changed
  * Person added
  * Person changed
  * Person group added
  * Person group changed
  * Person group removed
  * Person removed
  * Phase changed
  * Published
  * Relation added
  * Relation removed
  * Removed
  * Tag added
  * Tag removed
  * Template changed
  * Type changed
  * Unique Id changed
  * Unpublished
  * Version created
* Tasks
  * DataStore parameter was reloading too long
  * SSP Task was running too long
  * Studio Task was running too long
* Ticket
  * Delegate for actor in step added
  * Delegate for actor in step removed
  * Ended
  * Reopened
  * Started
  * Step actor ended
  * step actor started
  * step ended
  * step started
  * Task closed
  * Task message added
  * Ticketing fields changed
* Time
  * Day changed
  * Hour changed
* Web services
  * Web service call failed

## Setting up a new Trigger

To set up a new Trigger, you need:&#x20;

* an Event when the trigger happens
* Web Service call: Webservice that has to be performed when the event appears.&#x20;

Specific conditions for the trigger has to be coded in the web service.&#x20;

A trigger has to be performed when a person is added to a specific custom actor. \
without conditions in the webservice, the event trigger based on the event "person added" will perform always by adding a person to an actor. The condition must be that the event trigger may only perform when a person is added to the specific custom actor.&#x20;

## Examples

### Example 1 : a PI is added to a service

Purpose: When a PI is added to a service, some actions need to be done. \
In this example the CV and GCP has to be added to the documents of the service.&#x20;

To set this up, the event trigger can be set up with:&#x20;

<figure><img src="https://830009223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXCmB1C0E7jaoFbPx2p%2Fuploads%2FmvUMMfkHqPB4RtDjfgRp%2Fimage.png?alt=media&amp;token=9409509f-6641-4ac8-a902-d8b2588fa965" alt=""><figcaption></figcaption></figure>

* Event: Person changed
* Web service call: JS - Event trigger for PI selected. \
  (link to dev: <https://dev.ssp7.smt-x.com/Common/admin/WsCallAddEdit.aspx?genericid=442>)

<figure><img src="https://830009223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXCmB1C0E7jaoFbPx2p%2Fuploads%2F9cazUBZMEdi5G5ANMqyR%2Fimage.png?alt=media&amp;token=2628dd3c-2ed2-4cd2-a841-96fa216d6fcb" alt=""><figcaption></figcaption></figure>

In this Web Service, the needed specific code has to be adapted:&#x20;

1. internal name from the actor in the Service. When this actor changes, the Event trigger will be excecuted.&#x20;
2. process that will be started from the web service if the condition is fulfilled.&#x20;
3. name of the event trigger from wich tis web service is started.&#x20;

This webservice starts a Process "PI selected" that performs the necessary actions. The process is adaptable as wished. link to dev: <https://dev.ssp7.smt-x.com/workflow/Admin/ProcessAddEdit.aspx?genericid=440>

<figure><img src="https://830009223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXCmB1C0E7jaoFbPx2p%2Fuploads%2FrOClHAQyDgXdzd6IgYBe%2Fimage.png?alt=media&amp;token=ab3eaffc-53cd-4b1a-9499-af898a958dd1" alt=""><figcaption></figcaption></figure>

<figure><img src="https://830009223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXCmB1C0E7jaoFbPx2p%2Fuploads%2FHehfKEZQSYAbZyDCetKP%2Fimage.png?alt=media&amp;token=a5911054-ede5-4d3d-9b59-218ec6aa4943" alt=""><figcaption></figcaption></figure>

The steps "Save CV in temp" and "Save GCP in temp" get the documents from the person details to be used in the next steps.&#x20;
