Bpmn Events in Angular Diagram component

28 Mar 20259 minutes to read

Event

An event is a common BPMN process model element that represents something that happens during a business process and is notated with a circle. The type of events are as follows:

* Start
* Intermediate
* NonInterruptingStart
* NonInterruptingIntermediate
* ThrowingIntermediate
* End

The eventproperty of the node allows you to define the type of the event. The default value of the event is start. The following code example illustrates how to create a BPMN event.

import { DiagramModule, BpmnDiagramsService,DiagramComponent, NodeModel, BpmnShapeModel  } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from '@angular/core';

@Component({
imports: [
         DiagramModule
    ],

providers: [BpmnDiagramsService],
standalone: true,
    selector: "app-container",
    template: `<ejs-diagram #diagram id="diagram" width="100%" height="580px" [getNodeDefaults] ='getNodeDefaults'>
        <e-nodes>
        <e-node id='node1' [offsetX]=150 [offsetY]=150 [shape]='shape1'></e-node>
        <e-node id='node2' [offsetX]=350 [offsetY]=150 [shape]='shape2'></e-node>
        <e-node id='node3' [offsetX]=150 [offsetY]=350 [shape]='shape3'></e-node>
        <e-node id='node4' [offsetX]=350 [offsetY]=350 [shape]='shape4'></e-node>        </e-nodes>
    </ejs-diagram>`,
    encapsulation: ViewEncapsulation.None
})
export class AppComponent {
    @ViewChild("diagram")
    public diagram?: DiagramComponent;
    public shape1: BpmnShapeModel = {
        type: 'Bpmn',
        shape: 'Event',
        // set the event type as End
        event: {
            event: 'Start',
            trigger: 'None'
        }
    }
    public shape2: BpmnShapeModel = {
        type: 'Bpmn',
        shape: 'Event',
        // set the event type as End
        event: {
            event: 'End',
            trigger: 'None'
        }
    }
    public shape3: BpmnShapeModel = {
        type: 'Bpmn',
        shape: 'Event',
        // Sets event as NonInterruptingStart and trigger as Timer
        event: {
          event: 'NonInterruptingStart',
          trigger: 'Timer',
        }
    }
    public shape4: BpmnShapeModel = {
        type: 'Bpmn',
        shape: 'Event',
        // Sets event as NonInterruptingIntermediate and trigger as Escalation
        event: {
          event: 'NonInterruptingIntermediate',
          trigger: 'Escalation',
        }
    }
    public getNodeDefaults(node: NodeModel): NodeModel {
        node.height = 100;
        node.width = 100;
        return node;
    }
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));

BPMN event trigger

Event triggers are notated as icons inside the circle and they represent the specific details of the process. The trigger property of the node allows you to set the type of trigger and by default, it is set as none. The following table illustrates the type of event triggers.

Triggers Start Non-Interrupting Start Intermediate Non-Interrupting Intermediate Throwing Intermediate End  
None NoneStartImage NonInteruptingImage NoneIntermediateImage NoneNonInteruptingIntermediateImage None ThrowingIntermediate NoneEndImage  
Message MessageStartImage MessageNonInteruptingImage MessageIntermediateImage MessageNonInteruptingIntermediateImage Message Message  
Timer TimerStartImage TimerNonInteruptingImage TimerIntermediateImage TimerNonInteruptingIntermediateImage TimerThrowingintermediate TimerEndEventBPMNEndShape  
Conditional ConditionalStartImage ConditionalNonInteruptingImage ConditionalIntermediate ConditionalNonInteruptingIntermediateImage ConditionalThrowingintermediateBPMNShape ConditionalEndBPMNshape  
Link LinkStartBPMNShape Link  NonInterruptingStartBPMNShape LinkIntermediateImage LinkNonInterrupting intermediateBPMNShape LinkThrowingIntermediateImage LinkEndBPMNShape  
Signal SignalStartImage SignalNon-InterruptingImage SignalImage SignalNon-Interrupting IntermediateImage SignalThrowing IntermediateImage SignalEndImage  
Error ErrorStartImage Error Trigger Start Event BPMN Shape ErrorIntermediateImage Error Trigger NonInterrupting intermediate BPMN Shape Error Trigger Throwing intermediate BPMN Shape ErrorEndImage  
Escalation EscalationStartImage Non-InterruptingImage EscalationIntermediateImage EscalationNon-InterruptingImage EscalationThrowing IntermediateImage EscalationEndImage  
Termination TerminationStartEventBPMNShape TerminationNonInterruptingStartEventBPMNShape TerminationIntermediateEventBPMNShape TerminationNonInteruptingIntermediateEventBPMNShape TerminationThrowingintermediateEventBPMNShape TerminationEndImage  
Compensation CompensationStartImage CompensationTriggerNonInterruptingStartEventBPMNShape CompensationIntermediateImage CompensationNonInteruptingIntermediatEventBPMNShape CompensationThrowing IntermediateImage CompensationEndImage  
Cancel CancelStartEventBPMNShape CancelNonInterruptingStartEventBPMNShape CancelIntermediateImage Cancel  NonInteruptingIntermediateEventBPMNShape CancelThrowingIntermediateEventBPMNShape CancelEndIamge  
Multiple MultipleStartImage MultipleNon-InterruptingImage MultipleIntermediateImage MultipleNon-InterruptingImage MultipleThrowing IntermediateImage MultipleEndImage  
Parallel ParallelStartImage ParallelNon-InterruptingImage ParallelIntermediateImage ParallelEndImage ParallelThrowingIntermediateEventBPMNShape ParallelEndEventBPMN Shape