Calling a Workflow Instance
Using Workflow Instances for Modular Orchestration
In Liberate, the recommended approach for building orchestrations is to adopt a modular architecture, similar to a service-oriented architecture. This involves breaking down complex automation processes into reusable workflows that encapsulate specific business logic and capabilities.
Workflow instances allow you to incorporate these modular workflows within your automation pipeline, enabling the composition of end-to-end orchestrations. You can add workflow instances to the Liberate canvas, just like tasks, and pass context data from the current workflow to the target workflow.
How to Use Workflow Instances:
- Add Workflow Instance to Canvas: To include a workflow instance in your orchestration, add it to the Liberate canvas like any other task. You can do this by selecting the appropriate workflow from the properties panel.
- Specify Project and Workflow Name: When configuring the workflow instance, specify the project and workflow name to identify the target workflow. This ensures that the automation engine knows which workflow to execute.
- Send Context Data: To pass data from the current workflow to the workflow instance, utilize the context data. The context data represents the current state of the automation process. You can reshape the data before sending it to the workflow instance using JSONata expressions, similar to how you would in a Mapping Task.
Example: Sending Data to a Claim System via Workflow Instance:
Let's consider an example where you want to send data to a claim system represented by Airtable. The following steps illustrate how to configure the workflow instance:
- Sample Context: Start by defining the sample context data that contains the necessary information for the claim system.
{
"heap": "",
"session": {
"hub-radio": "file_a_claim",
"property-fnol-lob-options": "home",
"property-fnol-reporting-party-options": "cynthia",
"property-fnol-date-picker": "2023-04-18T07:00:00.000Z",
"property-fnol-location-options": "elm",
"property-fnol-loss-type-options": "plumbing",
"plumbing-radio": "broken",
"rooms-select": "2",
"leak-radio": "y",
"ale-radio": "no",
"property-fnol-damage-type-options": {
"home": true,
"other": false,
"belongings": false
},
"property-fnol-loss-description-input": "",
"property-fnol-virtual-inspection-options": "no",
"property-fnol-payment-preference-choices": "no",
"property-fnol-contact-phone": "3126181013",
"property-fnol-contact-email": "[email protected]",
"property-fnol-sms-options": "no",
"property-fnol-truth-options": "yes"
}
}- Expression: Create a JSONata expression that reshapes the context data into the desired format for the claim system. This expression maps the relevant fields from the context data to the corresponding fields expected by the claim system.
{
"base": "appcHtItXhqU****",
"table": "tblRPnHIo6uz****",
"fields": {
"lob": "$.session.`property-fnol-lob-options`",
"contact_email": "$.session.`property-fnol-contact-email`",
"ale_radio": "$.session.`ale-radio`",
"damage_description": "$.session.`property-fnol-loss-description-input`",
"has_belongings_damage": "$.session.`property-fnol-damage-type-options`.belongings",
"has_home_damage": "$.session.`property-fnol-damage-type-options`.home",
"has_other_damage": "$.session.`property-fnol-damage-type-options`.other",
"loss_type": "$.session.`property-fnol-loss-type-options`",
"reporting-party": "$.session.`property-fnol-reporting-party-options`",
"plumbing_issue": "$.session.`plumbing-radio`",
"active_leak": "$.session.`leak-radio`"
}
}- Output: The resulting output shows the reshaped data that will be sent to the claim system via the workflow instance. This data reflects the desired structure and format expected by the claim system.
{
"base": "appcHtItXhqUTERwh",
"table": "tblRPnHIo6uzUTziY",
"fields": {
"lob": "home",
"contact_email": "[email protected]",
"ale_radio": "no",
"damage_description": "",
"has_belongings_damage": false,
"has_home_damage": true,
"has_other_damage": false,
"loss_type": "plumbing",
"reporting-party": "cynthia",
"plumbing_issue": "broken",
"active_leak": "y"
}
}When to Use Workflow Instances:
Workflow instances are particularly useful in the following scenarios:
- Modular Orchestration: When your automation process consists of multiple workflows, workflow instances allow you to seamlessly integrate and compose these workflows, enhancing the overall modularity and reusability of your orchestrations.
- Specialized Capabilities: If you have specialized workflows that perform specific tasks or encapsulate certain business logic, utilizing workflow instances helps leverage these capabilities across multiple automation processes without duplicating code or logic.
- End-to-End Orchestration: Workflow instances enable the construction of end-to-end orchestrations by linking together individual workflows to achieve a comprehensive automation solution. This promotes better maintainability, scalability, and flexibility in managing complex automation pipelines.
Updated 9 months ago
