K2 blackpearl and K2 workflow processes do not always have to contain K2 client events where a task is created for a user to action using the K2 worklist.
K2 Automated Testing Software
BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.
I recently had a requirement from a customer to create a feature whereby the user can trigger a K2 server email to ensure outgoing email reaches users. In addition to this, a feature was also required to update a user’s email address in Active Directory and in the line of business system database.
The steps below outline how to crate such a process, and the thinking behind some of the design considerations.
First of all, I defined the two distinct K2 workflow utility routes as “Test Notification” and “Update Email”. Any K2 data fields’ names related to the two distinct rules are preceded by the route names. Also, the “Workflow Route” is a K2 data field is set when the process is initiated to route the K2 Workflow to the appropriate section of the K2 blackpearl process map.
K2 Object Browser – Define Process Data fieldsBy inspecting the K2 data fields, you can quickly work out now that two routes exists – each requiring inputs related to their respective names – and by convention, “Workflow Route” must contain either of the route names.
Adding an additional route is easy now. Define an appropriate name, create K2 data field(s) preceded by the name(s) and ensure the K2 line rules ensure routes are mutually exclusive.
K2 Utility Process – Workflow Route Line ruleTo keep things simple, I will discuss the Update Email route design.
K2 Utility Process – Update ADThe first K2 blackpearl activity has one K2 event that calls Active Directory and updates the user’s email address. In this instance, select Update a User like below:
K2 Event Wizard – Update AD UserThe next stage is to define the Domain Name. Note that the “Update Email Username” K2 data field process “input field” is used to construct the domain name. I simply hard coded the domain, but advise using a K2 Environment field to make deployment successful.
K2 Event Wizard – Specify Domain NameThe next step is to set the Active Directory user update input fields. Again, we simply map our defined “utility input fields” to the K2 event required inputs. Finish the K2 event wizard.
K2 Event Wizard – Specify New Email AddressThe next step simply shows how a K2 SmartObject is called to update the user’s email address in the line of business system. Once again, the input K2 data field value is mapped to the SmartObject input property.
K2 SmartObject Event Wizard – Update DatabaseAs a best practice, notify the K2 process originator and the user that the update is successful.
K2 Email Event Wizard – Notify UserThe final step of the K2 email event wizard is to construct the email body and finishing up the wizard.
K2 Email Event Wizard – Notification BodyThe benefit of this design is that the available utility features and their interfaces can be explored by inspecting the K2 blackpearl process data fields and K2 process map. Any exceptions will be trapped by K2 host server and can be re-tried using the K2 Workspace. Any K2 client events that create tasks for users can easily be introduced to add workflow routing driven by user inputs.