hideIfMatches filter in Confiforms

Aleks R February 15, 2024

Confiforms Hide controls when stored data (for given record) matches this criteria is not working as expected when trying to check security group combined with a check of record owners in ownedBy.

Using Confluence 8.5.4 and Confiforms 3.7.5.

Can you help @Alex Medved _ConfiForms_ ?

Setup

Simple table setup with two text fields:

1.png

This is the code:

<ac:structured-macro ac:macro-id="0ad74c21-fb01-43df-817e-a3d58b9a9c94" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">table</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="a66db9fa-0cb3-4d60-993d-48539c1e2aea" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">name</ac:parameter>
<ac:parameter ac:name="fieldLabel">Name</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="12829e65-4b62-45a4-8fae-f633f0d6fc0f" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">sport</ac:parameter>
<ac:parameter ac:name="fieldLabel">Sport</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="eafa07b7-3810-41de-84ea-1021aba01401" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>

Now add som sample data to the table:

2.PNG

Now create a simple view with an Edit Controls.

3.png

As you may have noticed the edit controls has the parameter Hide controls when stored data (for given record) matches this criteria set, with Reverse criteria checked:

4.png

These are the criteria used:

_user.userInSecurityGroup(confluence-administrators):true OR ownedBy:[entry._user]

We want the field only to be visible to members of confluence-administrators OR to record owners. This is working fine. Only owners or administrators are able to see the edit controls. Administrators can see all edit controls. Record owners can edit their records.

This is the code for the view:

<ac:structured-macro ac:macro-id="fde06381-dd68-40d1-b908-af4bd531c99d" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="pageTitle">
<ac:link>
<ri:page ri:content-title="Hide controls when stored data matches... — test"/>
</ac:link>
</ac:parameter>
<ac:parameter ac:name="formName">table</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="08818a04-2834-4a61-8fbe-90daa8b863f1" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">name</ac:parameter>
</ac:structured-macro> <ac:structured-macro ac:macro-id="f80933aa-d4f7-490b-9513-8c79e0a8b1e7" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">sport</ac:parameter>
</ac:structured-macro> </p>
<ac:structured-macro ac:macro-id="fadaf40f-b65a-41ff-bcfb-ad15039875de" ac:name="confiform-entry-edit" ac:schema-version="1">
<ac:parameter ac:name="showBoth">false</ac:parameter>
<ac:parameter ac:name="reverse">true</ac:parameter>
<ac:parameter ac:name="hideIfMatches">_user.userInSecurityGroup(confluence-administrators):true OR ownedBy:[entry._user]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>

So... what's not working?

However, the above criteria, with reverse criteria checked should, the way I understand things, be the same as specifying the following criteria

5.png

Criteria:

!(_user.userInSecurityGroup(confluence-administrators):true OR ownedBy:[entry._user])

Logically, this means if not either of these criteria are true, then hide the field in question.

This is not working.

Why is this a problem?

The above is not a problem for edit controls, because we an use Reverse criteria. However, for EntryViewer, there is no such option:

6.PNG

and we need to check if criteria are met using logical operators in the specified field, since we cannot negate using Reverse criteria when using EntryViewer.

Is there a way to achieve the desired check of both owndBy field and security group for EntryViewer?

Thanks for your help.

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2024

Hi

Should not the criteria actually be something like

_user.userInSecurityGroup(confluence-administrators):false AND !ownedBy:[entry._user]

meaning that when the use is not in "confluence-administrators" group and not is the owner of the record then .... hide

Alex

Aleks R February 19, 2024

That works. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events