This is a follow-up to the post where I describe how we configure and complete asynchronous server events. I showed you how one can complete the server event using a REST call, but sometimes a REST call is not needed or possible. In this post I will extend the mechanism to make use of SmartObjects on a SmartForm.
For this scenario, I am a technician, repairing customer machines on-site and I may not always have all the replacement parts on hand. When that happens, I can submit an order to the supplier which will deliver the part directly at the installation site. But, as we all know, deliveries are unpredictable and I won’t always be able to determine the actual delivery date and time.
To handle the variability, K2 will start a process when I submit the order, generate a QR code as part of the weigh bill and then wait for the next step. When the part is delivered, the receiving department will scan the QR code, which in turn will proceed to the next step where I will schedule the installation date with the customer.
The actual process will be more involved as one would typically wat to have the request approved if the part is over the budgeted amount, if special tools are needed for the installation, etc. but for this post I will focus on the asynchronous implementation. Here is what the flow looks like:
As I will need to access the K2 Workflow REST endpoint in a SmartForm, the REST endpoint needs to be wrapped in a SmartObject. To do this:
You can use the Generate SmartObjects from the Service Instance option:
Or manually create one by dragging the following object onto the design canvas in K2 Designer:
This SmartObject can now be used to interact with Server Events.
Here is what this form looks like:
In Wait for Delivery, I just map the order to the PDF form, but key is to check that Wait for external system box:
And that’s it. By configuring the process to wait as detail in the first post, one can wait for real world events (and electronic ones too of course) to complete, use an everyday device to interact with and complete the process and then proceed to the next step.
As the full application has a few more moving parts like approval and installation steps, I didn’t add those in the article and focus purely on the Async and Complete pieces of the workflow. Feel free to ping me if you have specific questions on the other parts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.