Use Start forms to launch a new case instance temporarily, and allow end users to confirm the process creation when they are certain of this action, or closing the form without confirming to avoid unnecessary case creation.
For example, in a vacation process a start form may reduce the amount of canceled cases due to lack of available vacation days.
Start Forms, as all forms are built using the Data Model defined in the Data Modeling,step of the Process Wizard.
The context entity of the Process is the starting point to access the data model, and therefore to each attribute that will constitute your Form.
Start forms do not support the Action launcher nor the Polymorphic launcher.
Start forms are ignored when the process is used as a sub-process. Be careful when using a Start form in a process that is called as a Sub-process: as the form is not displayed all required information has to be requested in the first manual task.
Create an Start form
Go to the third step of the Process Wizard and click on Define Forms to display the workflow of the Process. If you have not defined a form for the Start Event, this will be highlighted with an exclamation mark as shown in the image below.
Let's go back to the situation mentioned in the overview. In the Vacation Leave Request process, the end user can verify the number of available Vacation Days in order to decided whether to create the case or not.
1. Go to the third step of the Process Wizard. When the process model displays, click the Start form to create or edit its Form.
The Forms Designer will display. If there is no From previously built the Forms Designer will show a blank display area.
2. Add the fields Number of days available, Applicant and Applicant's Boss, and set them as read only.
3. The number of days available is calculated through a Web Service invocation, this can be done using an expression in the default value of the Number of days available field.
Select the Number of days available field and go to Advanced tab, create an expression in the Default value field.
4. Create an Expression to load the current user, a Web Service call and another Expression to set the value from the Web Service.
Create a variable called days where the answer of the Web Service will be stored.
Even though the end user has not created a Case, when you are working on the start form, you can access to the information stored in the context. Use the following code in the Load User activity to get the information of the end user.
<VacationRequest.Applicant> = Me.WorkingCredential.UserId;
For example purposes, the Web Service to be invoked is located at http://www.bizagi.com/ESB/ESBServices.asmx?wsdl and the method is called verifyAvailableVacationDays. Refer to Web service element for more information about how to invoke the Web Service.
The last expression is to set the result of the Web Service invocation, to do this, add this code line:
5. When your form is complete, click Save.
Log into the Work Portal to test the results. The following image displays the behavior of the Start Form, this forms is loaded in a Pop-up window displaying the information configured in this guideline.
In the previous example, we can see that Ellen Jacobs only has three vacation days available, so if she would like to start the vacation Request process, she just clicks on Create and the process flow will be started; Otherwise, she need to close the pop-up window and the process will not create any instance of the process.