Hiding Options in Workbrain Form Approvals

When working with forms and workflows in Workbrain, defining the workflow is as easy as drawing a line between two nodes in the Workflow Editor. We call this a branch. A text caption must also be defined for each branch, as that will be the command used to direct the workflow down that branch. When user input is required at a node in the workflow, such as an approval or rejection, these text captions are displayed to the user as options. The options typically would be "Accept" or "Deny".

Occasionally, we will need additional branches that the workflow could take. One example could be "Escalate", in which we want the form to route to a different user if no action is taken after a set time. I won't address how to actually time the form out in this scenario, but we certainly don't want that "Escalate" option to be displayed to the user. While there is not a configurable field for this in the Workflow Editor, it is a quick Javascript hack to hide this from the user. Let me explain how.

First, you should submit the form for which you are making this change. You'll want to bring up the Approve/Reject/Escalate screen and then put the application in config mode.


There you will be able to click on the diamond next to Comments. In the popup, you should change Comments to:


Comments<script>var lastOne=getElement('_branch_label_')[2]; if(lastOne != undefined && lastOne != null) { lastOne.parentNode.removeChild(lastOne); }</script>

This will check to see if there exists a third option and it will remove it, but in your Java code on the backend, you will still be able to direct the workflow down this branch. And it will end up looking like this:


It is important to note that we could perform this escalate functionality without needing to add the Escalated branch option if it didn't need to go to a new user. We could have easily set the node to exception status on timeout instead, but this allows the form to easily continue in the configured workflow.

0 comments:

Post a Comment