How to Get Work-type ID from an Event

When a plan is triggered, the event object (ev) carries data about the event, such as the related sharedo id. It is useful to have this data stored for the lifetime of the plan. You can do this by placing the data into a context object.

This example shows how to achieve this.

  1. When you have created your blank plan you will see this on your screen
  2. Your next step is to take information from the event to help you with your ongoing steps.
    For example: you may wish to create a task on the work type that initiated the plan. You want the task to be linked to the work type so you need to know the parent id.
  3. In the main function enter the following snippet
    ctx.sharedoId = ev.Data.sharedoId;
  4. This snippet takes the work type Id from the event and places it into your context object.
  5. The context object is available throughout the life of the plan so you can use ctx.sharedoId anywhere in the plan to refer to the parent work typethat caused the event.
  6. For example, if you want to link a task in your plan to the work type you can use.
    .ForSharedo(ctx.sharedoId)