applies to version: 8.2.x; author: Bartłomiej Spyrka
The following article will show you a simple yet effective way to visually enhance your Item lists by using customized status icons to track the progress of any task.
Imagine a workflow for distributing equipment to freshly hired employees. The entire process is based on an Item list, which displays the requested components that need to be prepared and allocated. Each element can be handled by a different employee – resulting in a simple task sub-process.
In the sub-process we can designate 4 different statuses representing progress on the the task in question (BPS supports 3 states by default – 0/1/2):
For the sake of simplicity and organization, the statuses above will correspond to specific Steps in a sub-process created to manage statuses, and will exist only as graphical sprites on the Item list in SharePoint.
Preparing the icons for status representation
You will need some images or sprites that will be used to represent statuses in the individual Steps – for simplicity’s sake, name the icons after the numbers corresponding to each state (0/1/2/3 mentioned above).
Next create an Image library in SharePoint (Site contents -> Add app.). Place your desired icon sprites into the library (Either individually, or select and drag them all from your folder into the browser window).
A SharePoint library is a better place to store your icons than a spot on the server, because many sites can access one library, you don’t have to worry about making sure they all have the path/access to the fragment of the server where the icons are located – having an image library solves any issues from the get go.
Designing a query that will start sub-processes
Essentially, we will be creating 2 workflows inside the Process, a main workflow and a sub-workflow. The main workflow will be responsible for handling the majority of “Requested items” Item list. The Sub-workflow will be tied to the ‘Status’ column of the item list, it will have 4 Steps corresponding to the 4 statuses (0/1/2/3) and will be responsible for using the “Change field value” Action to modify a technical Form field (in our example: _Status). An SQL query will then check that field and use the appropriate image.
Whenever there is a relation between sub-processes started from an Item list (Using the “Start many workflows” Action) and a parent process, it is helpful to keep them connected by an ID (DET_ID). In our case, we will use another technical Form field, which will in turn help us find the corresponding WFD_ID in the database.
Below is the configuration for a “Start many workflows” type Action (Named Start Sub-workflow) connected to the first Step of the Main workflow.
The Data tab – an SQL query that generates sub-workflows.
Configuring the sub-process
There are two things to keep in mind when configuring the sub-workflow to manage status icons:
- Each Step corresponds to a status (number)
- For each step we define an “On entry” Action of the “Change field value” kind, which will access and modify the relevant technical Form field (_Status)
Such a solution will provide integrity between Steps of the Workflow and statuses (corresponding to the names of the icons in our SharePoint library).
Configuring the status column
Create a new column for our Item list, where out custom status icons will be displayed. Set the Field type to “Hyperlink” and click the Configure button
The query posted above will post corresponding images instead of numbers in the ‘Status’ column, the icons will also double as links to the relevant Workflow task.
The first part of the @link variable contains the address to the SharePoint image library, the next part defines how the query is interpreted (each row of the Item list is serviced separately). The query result (WFD_AttInt1) relates directly to the name of the icon in the Image library.
The concatenation of text variables (1 – link to WFDynamic, displayname, Statusflag) results in the final URL, which will be hidden under the status icon sprite, in the form of a hyperlink.
Following the Paths and Steps of the main workflow will cause the sub-workflow to alter the Status field (“On entry” “Change field value”). This in turn will cause the correct status icon to be displayed.
BPS supports 3 predefined statuses by default. If necessary however, it can support any number of statuses with an unrestricted choice of images (as long as they are reasonable 🙂 ) to use as status icons.