Polymorphic Launcher
Use
The Polymorphic Launcher control displays all Actions according to the inheritance defined for the parent entity, in a tree-like structure. Refer to Inheritance in data modeling to know more about Inheritance and polymorphism.
The control will only display the available Actions for the Stakeholder.
Considerations
To use a Polymorphic Launcher Control:
- The Polymorphic Launcher control is not supported in Start forms.
- You must have defined Inheritance in your Data Model.
- There must be a one-to-many relationship from a master entity to the hierarchical parent entity.
- The entity related to the action to be launched using the control must have a constructor previously defined. For more information, refer to Constructors.
- If a child node has a constructor, the Polymorphic Launcher will display the hierarchy of its parent entities. If not, it will not be displayed.
Properties
Every control has a set of properties that allow customizing its behavior in the Work Portal. However, some properties are exclusive to a specific control. The following are properties exclusive to the Polymorphic Launcher control:
Basic tab
PROPERTY | DESCRIPTION |
---|---|
Data source | XPath of the hierarchical parent Entity |
Additional xpaths | Define the data of the current process that has to be injected in each of the forms or processes launched. |
Allow to Search | Displays a Search box in order to find the required action. |
Example
In the next example, we will use our Bizagi Hospital project. In the Examine patient activity, a doctor can order many exams according to the result of the examination. The available exams for a patient follow a hierarchical structure explained in the image below:
Using the Polymorphic features developed by Bizagi, we can display this structure in any form within our process.
As you can see, we have in our data model a one-to-many relationship with the hierarchical parent entity (Available exams), represented by the XPath Triage.Patient.MyExams.
-
Define the hierarchical structure of the exams in Bizagi Studio, reviewing the example presented in Inheritance in data modeling to create such a structure.
In our example, the leaf nodes will be available to be launched. Therefore, build a constructor for each one.
-
Go to the Triage process and open the form of the Examine patient activity. Go to the Controls tab and expand Bizagi controls.
Drag and drop the Polymorphic Launcher control.
-
Open the control's properties and set the Data source. As we mentioned before, we have in our data model a one-to-many relationship with the hierarchical parent entity (Available exams), represented by the XPath Triage.Patient.MyExams.
-
The entities of the leaf nodes defined in Step 1 have a relation with Patient and Doctor, so it is required to send the information of the current patient and the attending doctor to the entities. Select the xpaths Triage.Patient and Triage.Attendingphysician in the Additional xpaths property.
Click on the button for each additional XPath you want to add.
-
Set the Allow to Search property to true in order to help the Doctor find an exam.
-
Save the changes and go to the Work Portal to test the results.
In order to set an action (order an exam to the patient) to be executed, click on the icon to add the action to the list of actions to execute when you click on next:
When the constructor of the selected action uses a process with a Start Form, a modal window will be displayed, and when the user saves the information of the start form, the control will list the action.