Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

So in total we will have 5 fields here:

Image Added

  • form has additional user groups set as administrators
    Image Added
  • Ordinal textarea field (proposaltext)

 

  • Formula field to calculate the value for the visual representation of the current status with this expression/formula (statelabel)

 

Code Block
IF("[entry.approvedByFin]", "Approved By Finance", IF("[entry.approvedByPM]", "Approved By PMs", IF(NOT("[entry.approvedByDevs]"), "Created", "Approved By Devs")))

Image Added

  • Checkbox to track approvals by developers (see "devs" set as a user group this field is visible to)
    Image Added
  • Checkbox to track approvals by projects managers (see "pm" set as a user group this field is visible to)
    Image Added
  • Checkbox to track approvals by finance (see "fin" set as a user group this field is visible to)
    Image Added
  • We have also specified the rules to hide check box fields when record is created
    Image Added
    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:

Code Block
<ac:structured-macro ac:macro-id="81b6f18d-2cd2-4604-b9f3-7a3ea40d77fd" ac:name="confiform"
                                  ac:schema-version="1">
<ac:parameter ac:name="additionalFormAdmins">devs,pm,fin</ac:parameter>
<ac:parameter ac:name="formName">proposals</ac:parameter>
<ac:parameter ac:name="saveButtonLabel">Register proposal</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Register</ac:parameter>
<ac:rich-text-body>
  <p>
    <ac:structured-macro ac:macro-id="2b3a3bb8-fe7b-4e81-825f-ccda6816e9f5" ac:name="confiform-field-definition"
                         ac:schema-version="1">
      <ac:parameter ac:name="fieldName">proposaltext</ac:parameter>
      <ac:parameter ac:name="fieldLabel">Proposal text</ac:parameter>
      <ac:parameter ac:name="type">textarea</ac:parameter>
    </ac:structured-macro>
  </p>
  <p>
    <ac:structured-macro ac:macro-id="a6894605-f8a2-4954-8eab-f5779e267abe" ac:name="confiform-field-definition"
                         ac:schema-version="1">
      <ac:parameter ac:name="fieldName">statelabel</ac:parameter>
      <ac:parameter ac:name="fieldLabel">State</ac:parameter>
      <ac:parameter ac:name="extras">IF(&quot;[entry.approvedByFin]&quot;, &quot;Approved By Finance&quot;, IF(&quot;[entry.approvedByPM]&quot;,
        &quot;Approved By PMs&quot;, IF(NOT(&quot;[entry.approvedByDevs]&quot;), &quot;Created&quot;, &quot;Approved By
        Devs&quot;)))
      </ac:parameter>
      <ac:parameter ac:name="type">formula</ac:parameter>
    </ac:structured-macro>
  </p>
  <p>
    <ac:structured-macro ac:macro-id="b557fad8-d633-4e1d-8fa9-993eea0c3f53" ac:name="confiform-field-definition"
                         ac:schema-version="1">
      <ac:parameter ac:name="editRestrictions">devs</ac:parameter>
      <ac:parameter ac:name="fieldName">approvedByDevs</ac:parameter>
      <ac:parameter ac:name="fieldLabel">Approved (Devs)</ac:parameter>
      <ac:parameter ac:name="restrictions">devs</ac:parameter>
      <ac:parameter ac:name="type">checkbox</ac:parameter>
    </ac:structured-macro>
  </p>
  <ac:structured-macro ac:macro-id="16541513-8b13-47b1-9bf1-53e85f6a8f00" ac:name="confiform-field-definition"
                       ac:schema-version="1">
    <ac:parameter ac:name="editRestrictions">pm</ac:parameter>
    <ac:parameter ac:name="fieldName">approvedByPM</ac:parameter>
    <ac:parameter ac:name="fieldLabel">Approved By (PMs)</ac:parameter>
    <ac:parameter ac:name="restrictions">pm</ac:parameter>
    <ac:parameter ac:name="type">checkbox</ac:parameter>
  </ac:structured-macro>
  <p>
    <ac:structured-macro ac:macro-id="fb050936-7372-47b2-b6ca-a78a88e36600" ac:name="confiform-field-definition"
                         ac:schema-version="1">
      <ac:parameter ac:name="editRestrictions">fin</ac:parameter>
      <ac:parameter ac:name="fieldName">approvedByFin</ac:parameter>
      <ac:parameter ac:name="fieldLabel">Approved By (Finance)</ac:parameter>
      <ac:parameter ac:name="restrictions">fin</ac:parameter>
      <ac:parameter ac:name="type">checkbox</ac:parameter>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="e30b9daf-18a1-4d15-936a-cdeafb2c4715" ac:name="confiform-entry-register"
                         ac:schema-version="1">
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:rich-text-body>
        <p>&nbsp;</p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="58421c25-de39-45da-b5f2-4d3b349470c8" ac:name="confiform-field-definition-rules"
                         ac:schema-version="1">
      <ac:parameter ac:name="condition">id:</ac:parameter>
      <ac:parameter ac:name="fieldName">approvedByDevs,approvedByPM,approvedByFin</ac:parameter>
      <ac:parameter ac:name="action">Hide field</ac:parameter>
      <ac:parameter ac:name="actionFieldName">statelabel</ac:parameter>
    </ac:structured-macro>
  </p>
</ac:rich-text-body>
</ac:structured-macro>

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

Image Added

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
    Image Added
    Visible to only "devs" user group and hidden if already approved

  • Second edit button, we call it "ApprovePM" has the following settings
    Image Added
    Visible to only "pm" group and hidden when the following condition is met: 

    Code Block
    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
    Image Added
    Visible to only users in "fin" user group and hidden when the following condition is met: 

    Code Block
    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

    Code Block
    <ac:structured-macro ac:macro-id="96b70748-706b-4115-aaf2-5b9ae013b151" ac:name="confiform-list"
                                               ac:schema-version="1">
    <ac:parameter ac:name="formName">proposals</ac:parameter>
    <ac:rich-text-body>
      <h3>Proposal:</h3>
      <p>
        <ac:structured-macro ac:macro-id="ab7fd363-7416-40c7-b9fa-58d253f49c81" ac:name="confiform-field"
                             ac:schema-version="1">
          <ac:parameter ac:name="fieldName">proposaltext</ac:parameter>
        </ac:structured-macro>
      </p>
      <p>
        <strong>
          <ac:structured-macro ac:macro-id="cf8c064e-18f4-48ea-922c-18b9b348f13d" ac:name="confiform-field"
                               ac:schema-version="1">
            <ac:parameter ac:name="fieldName">statelabel</ac:parameter>
          </ac:structured-macro>
        </strong>
        <ac:structured-macro ac:macro-id="f04196d7-d5fe-49ed-a347-7a7234fe1b96" ac:name="confiform-entry-edit"
                             ac:schema-version="1">
          <ac:parameter ac:name="restrictions">devs</ac:parameter>
          <ac:parameter ac:name="showBoth">false</ac:parameter>
          <ac:parameter ac:name="hideIfMatches">approvedByDevs:true</ac:parameter>
          <ac:parameter ac:name="updateMessage">Approved</ac:parameter>
          <ac:parameter ac:name="editButtonLabel">ApproveDEV</ac:parameter>
        </ac:structured-macro>
        <ac:structured-macro ac:macro-id="c69b2a2c-b742-448d-be62-118d36680eb3" ac:name="confiform-entry-edit"
                             ac:schema-version="1">
          <ac:parameter ac:name="restrictions">pm</ac:parameter>
          <ac:parameter ac:name="showBoth">false</ac:parameter>
          <ac:parameter ac:name="hideIfMatches">approvedByFin:true OR approvedByPM:true OR approvedByDevs:false
          </ac:parameter>
          <ac:parameter ac:name="updateMessage">Approved</ac:parameter>
          <ac:parameter ac:name="editButtonLabel">ApprovePM</ac:parameter>
        </ac:structured-macro>
        <ac:structured-macro ac:macro-id="4ae8ce8d-066b-40b4-a74a-a564f58dc03a" ac:name="confiform-entry-edit"
                             ac:schema-version="1">
          <ac:parameter ac:name="restrictions">fin</ac:parameter>
          <ac:parameter ac:name="showBoth">false</ac:parameter>
          <ac:parameter ac:name="hideIfMatches">approvedByFin:true OR approvedByPM:false OR approvedByDevs:false
          </ac:parameter>
          <ac:parameter ac:name="updateMessage">Approved</ac:parameter>
          <ac:parameter ac:name="editButtonLabel">ApproveFIN</ac:parameter>
        </ac:structured-macro>
      </p>
      <p>&nbsp;</p>
    </ac:rich-text-body>
    </ac:structured-macro>

    And this is how the form looks like in Confluence view mode:

    Image Added


    This is how it is seeing by FINANCE team

    Image Added


    Info

    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".