Prototyping a Workflow-Driven Application in a Day – Part 4
Prototyping a Workflow-Driven Application in a Day – Part 4
Join the DZone community and get the full member experience.Join For Free
How do you break a Monolith into Microservices at Scale? This ebook shows strategies and techniques for building scalable and resilient microservices.
Upon completing the third part of this tutorial, you would have designed and deployed a leave application process, as well as having the workflow participants and activities mapped accordingly, using Joget Workflow. Now, it's time to run the process, and see it in action!
Have we written any line of programming code yet? No ;)
User Accounts to Run the Process
Before we further proceed, let's make sure that we are still in the loop on the same picture. We need 2 user accounts to simulate the process, with the following usernames:
Let's navigate to Setup Users > Manage Users in the Workflow Management Console, and make sure that you have the 2 above mentioned user accounts created in Joget Workflow. The default password is 'password' (without single quote). Else, please create these users.
As an overview, these are what we'll be doing now:
- Login as 'applicant' to submit a leave application
- Login as 'approver' to approve/reject the leave application
- Trace completed processes to verify that the Leave Approval Process was completely executed
So, let's logout as 'admin', and login to Workflow Management Console as 'applicant'. As a normal user, applicant is not accessible to workflow design and administrative functions.
Go to Home > Run a Process, and click on "Leave Approval Process". Then, simply click the huge "Run Process" button to continue.
Figure 4.1: Run Process screen
With no surprise, you will be greeted with the Leave Application Form that we've designed using Form Builder in Part 3 of this tutorial.
Fill up the "Start Date", "End Date" and "Reason" fields, then click "Complete Task" button to submit the form.
Watch the Running Process
According to the workflow design that we have deployed, the process will come to a state that requires approver's attention, after leave application submission by the application.
Assuming if this is a very complex process, and you're the administrator monitoring a Joget Workflow implementation for your organization. In event when we need to know which activity a process is pending at, we can trace all details of a running process in Workflow Management Console.Logout as 'applicant', and login as ' admin' again. Navigate to Monitor Processes > Running Processes, and we will see an instance of the Leave Approval Process listed in the listing table. Clicking into this process instance, details of all its opened activities will be revealed, as shown in Figure 4.2.
Figure 4.2: View running process
We may click on the View Graph button to view the process design image, and the activity pending to be performed is shaded in yellow color as indication.
As we can tell from the activity list (Figure 4.2) and graph of the running process, we should now login as 'approver' to perform the "Leave Approval" activity.
Logout as 'admin', and login to Workflow Management Console again as 'approver'. In the Inbox, we should see an activity named "Leave Approval" in the task listing. Click on this item to accept the task, and we'll be able to view leave application details submitted by applicant, as well as a radio button group labeled "Leave Approval" that has 2 options.
Being a nice approver, shouldn't we approve the leave application? So let's select the "Yes, approved" option, and click "Complete Task" button to submit the approval form.
Trace the Completed Process
Logout to Workflow Management Console as 'admin', and navigate to Monitor Processes > Completed Processes.
The instance of "Leave Approval Process" that we've just tried is now listed as a completed process, instead of running process. Clicking into the process instance details, reveals that this instance was completed with "Email Notification of Approved Application" as the last activity executed.
Figure 4.3: View completed process
If you have correctly configured the SMTP settings in Email Plugin, then you would also have received an email notification at the designated email address.
Using Plugins to Integrate with External Systems
As we've seen in this 4-part tutorial, Joget Workflow enables us to quickly design and deploy a workflow-driven application, and flexibly maintain the process design to cater for dynamically evolving business rules.
In the example shown in this tutorial, the Leave Approval Process is not just having human participant, but a system participant as well to execute system-automatable activities (interacts with SMTP server to send email notification). Joget Workflow achieves and fulfills the wide array of needs for integration to external system, by supporting a plugin-oriented architecture, with each plugin being an OSGi JAR.
You would have noticed (Settings > Manage Plugins in Workflow Management Console) that there are more than just Email Plugin bundled into Joget Workflow, for example:
- BeanShell Plugin: Execute valid Java code statements during run-time. So for example, you may query an external MySQL database during process execution.
- Form Data ETL Plugin: Execute SQL insert and update via JDBC
As you could imagine, the possibility is practically endless with plugin-oriented architecture and community-friendly open source licensing.
Integrate into Joget Workflow from External System using JSON APIs
Since we have discussed about integrating to external system from Joget Workflow using plugins, you are probably asking "what about integrating into Joget Workflow from external system?"
Imagine the following scenarios:
- You have a web application build with PHP. Upon submission of a data form from the PHP application, you would like to automatically start a process in Joget Workflow.
- You have portal application in your organization, and you would like to have the listing of Joget Workflow tasks displayed in a portlet.
You may engage community help at Joget Workflow Forum in SourceForge.
Opinions expressed by DZone contributors are their own.