Table of Contents | ||
---|---|---|
|
Introduction
In this tutorial you will learn how to design, deploy and start a BPMN 2.0 Workflow using No Code (= no coding is required).
...
Code Block | ||
---|---|---|
| ||
{ "id": "8b299ab8-6b27-11ee-b0e8-4a5f1be5bab2", "businessKey": null, "tenantId": null, "state": null } |
Step 6: List deployments and instances (optional)
Optional steps for advanced / interested users: List all deployments and process instances using a pipeline.
In case you are not familiar with pipelines or don't want to write low code, you can skip this step and go on with next.
You can list the deployed workflow using a pipeline. Go to LOW CODE -> Playground and execute this pipeline (or use the pipeline designer):
Code Block | ||
---|---|---|
| ||
pipeline:
- workflow.deployment.find |
This lists all deployments including the one deployed by you. You should see an entry like this in the output (there can be more than one deployments on your instance):
Code Block |
---|
[
{
"id": "38a18bcb-6a46-11ee-b0e8-4a5f1be5bab2",
"name": "io.pipeforce.tutorial-14-bpmn_vacation-request",
"source": null,
"deploymentTime": "2023-10-14T04:00:32.543+0000",
"tenantId": null
}
] |
As you can see, the name of your deployment is io.pipeforce.tutorial-14-bpmn_vacation-request since a combination like this is automatically created on deployment: <APP_NAME>_<WORKFLOW_NAME>.
Remember this whenever you would like to refer to your deployment and execute it for example. It is also known as the workflow key.
You can list all instances using the workflow.find.processinstances command with your workflow key from above as argument. Go to LOW CODE -> Playground and execute this pipeline (or use the pipeline designer):
Code Block |
---|
pipeline:
- workflow.find.processinstances:
processDefinitionKey: io.pipeforce.tutorial-14-bpmn_vacation-request |
This will return you all process instances of the given workflow as JSON.
Step 7: Start workflow and assign a task to a user
In this step you will start a workflow and assign the first task to the logged-in user using a custom tile:
Select the app io.pipeforce.tutorial-14-bpmn in the portal.
Click the plus + icon at the top.
Create a new Tile with name workflowstart.
Use this configuration (copy & paste + save the property):
Code Block |
---|
{
"title": "Start Workflow",
"description": "Starts the Workflow",
"icon": "task_alt",
"color": "#000000",
"type": "workflow",
"data": "io.pipeforce.tutorial-14-bpmn_vacation-request"
} |
Go to Installed App -> io.pipeforce.tutorial-14-bpmn
Click Start Workflow. The workflow was no started and assigned to the currently logged-in user which is you.
Go to WORKFLOW -> Tasks → Assigned to Me. You should see the task listed here. Select it. Set Vacation Start and Vacation End date, then click COMPLETE.
After you have completed the vacation request, the task disappears from your list since now the process flow is already in the next step: The Review request step:
...
Step 8: Claim and complete a task
In this step you will learn how you can manually claim and complete a task in the portal.
Noteworthy:
Claiming a task means assigning it to a specific user for completion and is usually done automatically. In this tutorial we will do it manually in order to show you how this works.
Go to WORKFLOW → Tasks → Assigned to Me.
As you can see, there are no tasks listed for you. The list is empty. The reason is because no task is assigned (= claimed) to you so far (at least related to this tutorial).
This we gonna change in the next step.
Select the filter All Tasks.
Now you should see the task Review Request in the list. Click it.
Now click on top right corner: Claim
After you did claim the task Review Request, it will again become visible in your Assigned to Me filter.
Select Vacation Approved and click COMPLETE.
After a while, you should get the approval email to your inbox.
Congratulations, your approval workflow is alive and works!
In the next steps we're going to improve this workflow a bit.
Step 8: Use workflow variables in side automation pipeline
In this step you will learn how to use workflow variables in a pipeline.
Currently, your pipelines send-approved-email and send-declined-email are static. There is no dynamic behaviour or data in them.
Now, we are going to change this and use the vacationStartDate and vacationEndDate variables from the user forms and refer these values from inside the pipeline to send them with the email message.
All workflow variables like form fields are automatically passed to a pipeline to the vars scope. Inside the pipeline, you can then access these variables. Examples:${vars.vacationStartDate}
, ${vars.vacationEndDate}
:
Change your pipelines in order to use the workflow variables:
Open your pipeline send-declined-email
Change the email message like shown below:
Code Block | ||
---|---|---|
| ||
pipeline:
- mail.send:
to: "requester@email.tld"
subject: "Vacation Request Declined"
message: |
Hello, your vacation request from ${@date.format(vars.vacationStartDate, 'dd/MM/YYYY')}
to ${@date.format(vars.vacationEndDate, 'dd/MM/YYYY')} was declined. I'm sorry.. |
As you can see, we use the @date.format
util to format the date and place the result in the email message.
Click SAVE
to save the pipeline.
Repeat the steps with the pipeline send-approved-email.
Now, execute the workflow again and you should receive emails with the vacationStartDate and vacationEndDate dynamically set, like this example shows:
...
This way you can access any workflow variable inside your pipelines.