Page tree

Playground and DEMO space

This is a playground and demo space for ConfiForms and ConfiDoc addons developed and supported by Vertuna LLC

Most pages provide a storage format for the demo, so you can use the free add-on from Atlassian Confluence Source Editor to import this configuration into your Confluence and see it in action

To import examples from the storage format on Confluence Cloud please see this page

Please note, all the examples here are provided without any obligation and may or may not be incomplete or may have bugs, and we provide NO SUPPORT for these examples and demos.

In this tutorial we show how to ensure your form user will be able to enter just one record without setting "Enforce one entry per user" setting on a ConfiForms Form Definition macro

This is sometimes very handy, as you want to ensure that the enforcement rule works for some but not all (smile)

ConfiForms Rules for Field Definition macro is to the rescue! 

We will have a form with just one field (for simplicity)

We will add a rule with the following settings

Condition is defined as follows:

ownedBy:[entry.ownedBy] AND _count:>1 AND _user.userInSecurityGroup(confluence-administrators):false

We check for record ownership and see how many of these are already registered and we do it only if a user is not in the "confluence-administrators" security group (userInSecurityGroup is the function available in ConfiForms Virtual functions). _count is the context variable you can access from a context Accessing field values and properties#Additionalvaluesavailableinthecontext

Users who are not in the "confluence-administrators" user group will be allowed to enter only one record

Complete form looks like this

And when used by a non admin and there is an attempt to enter another record 

Storage format for the solution

<ac:structured-macro ac:macro-id="57d87851-3132-4c5c-b13f-af3423293b4f" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
    <ac:structured-macro ac:macro-id="d594d9a9-09e8-49e5-b436-d7f1d5c57c86" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:parameter ac:name="embedded">true</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:structured-macro ac:macro-id="501d3676-5e26-496f-8554-8828abaa37a6" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">somefield</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Just some field here</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      <ac:structured-macro ac:macro-id="6b07cd3c-bfc2-4b3c-9158-d0df83c6dce0" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">ownedBy:[entry.ownedBy] AND _count:>1 AND _user.userInSecurityGroup(confluence-administrators):false</ac:parameter>
        <ac:parameter ac:name="fieldName">Sorry, you have already registered</ac:parameter>
        <ac:parameter ac:name="action">Validation rule dataset</ac:parameter>
  • No labels