This solution has been prepared before the ConfiForms had the feature to update own records based on the conditions.
However, this tutorial is still good way to demonstrate how formula fields could work together and what you can achieve
We will have 3 user groups who should be able to approve a proposal in a sequential way, one by one and only when a proposal is in a certain state.
3 user groups (security groups in Confluence) are as follows:
devs - developers security group
pm - project managers group (gives approval after the DEVs)
fin - finance (gives approvals after the PMs)
The form is very simple and has 2 common fields to capture the proposal text in a plaintext format and to set a readonly field to show the proposal approval state as a text.
For each user group we will setup own field control of type "checkbox" to change current approval state to next state. Fields are restricted to be editable by certain user group only
So in total we will have 5 fields here:
form has additional user groups set as administrators
Ordinal textarea field (proposaltext)
Formula field to calculate the value for the visual representation of the current status with this expression/formula (statelabel)
IF("[entry.approvedByFin]", "Approved By Finance", IF("[entry.approvedByPM]", "Approved By PMs", IF(NOT("[entry.approvedByDevs]"), "Created", "Approved By Devs")))
Checkbox to track approvals by developers (see "devs" set as a user group this field is visible to)
Checkbox to track approvals by projects managers (see "pm" set as a user group this field is visible to)
Checkbox to track approvals by finance (see "fin" set as a user group this field is visible to)
We have also specified the rules to hide check box fields when record is created The rule means that when an entry (record) does not have an ID (id:) then hide checkbox fields (field names are listed as csv: approvedByDevs,approvedByPM,approvedByFin)
The whole storage format for the form is listed below:
This is about everything about form configuration, let's proceed with an actual approvals workflow.
We use ListView macro to show the data and have setup multiple edit buttons what are visible to certain user groups. Here is how it looks in the editor
So, we reference the form by name ("proposals") and put references to field definitions using ConfiForms Field macros. So far, so good. Simple and straightforward. The trick though is with configuration of ConfiForms Edit Controls. We want it to appear only for certain user groups and only when a record is in certain condition. Let's see it in details:
First edit button, we call it "ApproveDEV" has the following settings Visible to only "devs" user group and hidden if already approved
Second edit button, we call it "ApprovePM" has the following settings Visible to only "pm" group and hidden when the following condition is met:
approvedByFin:true OR approvedByPM:true OR approvedByDevs:false
Explanation: Button will be hidden when it already approved by PMs, or not approved yet by DEVs, or already approved by FINANCE
Third edit button, we call it "ApproveFIN" has the following settings Visible to only users in "fin" user group and hidden when the following condition is met:
approvedByFin:true OR approvedByPM:false OR approvedByDevs:false
Explanation: Button will be hidden when it already approved by FINANCE, or not approved yet by PMs or not yet approved by DEVs
Full storage format for this list view is listed below
And this is how the form looks like in Confluence view mode:
This is how it is seeing by FINANCE team
Final note: the solution presented here is just one way of implementing such requirements. As ConfiForms is very flexible and powerful in terms of how you can do things and what you can do.
More ideas on how it can be implemented:
- instead of using "Formula" field to track visual representation of current approval state you can employ a "readonly" field which will be updated using by defining "Set Value" Field rules for each checkbox field. Meaning that you just define a ConfiForms Field Definition Rules macro for each checkbox field and use a "Set Value" action to set the value (caption) for "readonly field"
- also, instead of using "readonly" field you can use any field type which you actually want, a status field might be a good choice. In our example above we have just showed that you can use "formula" fields to track the status "automatically".
If you are curious then here is the storage format for another solution
3 more rules for Field definitions (for each checkbox). The rule basically just sets/updates the value for readonly field (statelabel)