We can start a work item based on a condition by using a conditional start event. In HEFLO, this condition is linked to a record.
In this article we will learn how to:
1- Create a process instance every time we add a row of data to the record or update it.
2- Create multiple work items based on the number of rows imported into the record.
3- Plan the creation of the process instance.
In all 3 cases we need a custom record. If you do not already have one in your environment, then you must create one to continue.
To learn more about custom records and how to create one: How to create a record.
1- Create a process instance each time a data line is added to a record or updated.
The goal is to be able to automatically create a process instance every time a user adds data or updates a record. You must follow the following steps to make this configuration:
- In the process editor, enable process automation.
- From the BPMN toolbox, drag and drop a condition start event.
- Select the event and go to the Properties tab.
- In the execution part, choose the record that interests you in the “Associated custom record” field.
Please note that if you do not already have a custom record, you must create one to continue. To learn more about records and how to create them: How to create a record.
In our example, we select the “Supplier” record.
This record has 3 properties:
For information: Only custom records appear in this part.
After selecting the desired record, other fields appear.
We will present the “Configure business rule” button in the third part of our article.
- Select the option: “One instance per record” in the “Creation Mode” field.
- In your first task’s form, add fields so that you can transfer the information entered in the record to the work item that will be executed.
- Then click on the button: “Input parameters”.
The objective of this screen is to be able to associate the information from the record with that from the process forms.On the right side you will find the fields of the source record. The system automatically displays the columns of the record.On the left side, you will find empty fields.You must then select the field that will be associated with the desired column of the record. You must select fields associated with the forms in the relevant process so that this information is visible when the work item runs.
Once this association is made and the process published, a work item will be created by adding a new line in the “Supplier” record. The information for the line concerned will be transmitted in the associated fields.In our case, this information will be visible in the form associated with the “Check supplier information” task. - Click “Confirm” to save this configuration.
- Publish process automation.
Please note that this process cannot be started manually, this means we cannot create an instance of the process from the list: “New Work item”.
- Go to the workspace, and click on the page that contains the relevant record. In our case, this is the “Suppliers” page.
- Add a new supplier.
- Complete the fields in the record form and confirm.
For information: After adding a new line in the record, the system takes between 5 and 10 minutes to create a work item of the associated process. - Once this time has passed, go to the task list.
A new instance of the “Conditional start event” process has been created.
- Open the relevant work item.
The supplier information, created in the record, is present in the form fields of this work item.
2- Create a work item for each data imported into a record.
The goal is to be able to automatically create a process instance for each line created in a record when you import a file.
To learn more about importing data to update a record: Import data to update a record.
We will import a file to update the “Supplier” record and configure the process so that this import automatically creates a work item for each row.
You must follow these steps to make this configuration:
- Configure the conditional start event as seen in the first part of this article.
- Publish process automation.
- Import a record using the same steps as ” Import data to update a record“.
Here is the data imported for this example: Go to the task list, as you can see, 6 new work items have been created.
It is the choice of the “One instance per record” option which allows you to create a work item for each line that has been imported into the record.
3- Plan the creation of an instance:
The goal is to be able to automatically create a process instance when a line in a record meets a condition.
We can associate a business rule to determine the condition that will automatically create a work item.
To learn more about business rules: Introduction to Business Rules.
Follow these steps to make this configuration:
- Keep the configuration of the conditional start event made previously.
- Click on the start event and go to the Properties tab.
- In the execution section, click the “Configure business rule” button to create the condition that will allow the creation of the work item.
- Create the condition. For this example, it is based on the field: “Contract start date” which must correspond to the current day.
When a line in the record meets this condition, the system will automatically create a work item corresponding to it. In this example, the supplier’s contract start date must match the current day for the system to automatically create a work item.For information: In the case of creating a business rule for a conditional start event, the system gives the possibility of choosing only the properties of the record concerned. In this example, it is possible to select only the properties of the “Supplier” record. - Click “Confirm”.
- Create new rows in the “Supplier” record. In this example, we have created 3 new lines.
New work items will be created when the date of the “contract start date” property is reached.
The system created the work item linked to supplier line 1 on the day corresponding to the contract start date.