The setEvent function is used to execute an available intermediate Event in Bizagi, which has no specific type defined.
For example, it can be used on an expression related to a button to execute an intermediate event in my process. The function can execute events in the active process or in an external process.
The syntax of this function is:
The main parameters of this function are:
•The Caseid: the identification number of the Case in which the Event will be triggered
•The Event Name: the name of the event to be executed
•The first and last parameters (Me and null) are fixed.
The setEvent function is found in the Process category.
Let us take the Help Desk Process as example. Once a case is created, an Event is enabled that allows the case to be closed at any time, as shown in the Process flow below.
The Analyze and Resolve Task contains a button that will close the case automatically if clicked
This button will call the Close Case Event. The Process flow will reach the End Event and the case will be closed.
To configure the case closing Event, follow the next procedure:
1. Go to the form of the Analyze and Resolve Task, include a new button and name it Close Case.
Create an action (from Actions and validations) when the button is clicked, then select execute rule in the Then block.
2. In the argument, click on New and then include an Expression module.
Select the setEvent function.
3. Value the parameters of the setEvent function.
The Caseid is obtained using the Me.Case.Id function which returns the ID of the current case.
The Event Name, is CloseCase.
You can verify the name in the Event properties of the Task by going to first step of the Process Wizard.
Save the expression. When you click on the Close Case button from the Work Portal the case will be closed.