Restrict field vidibility
Asked by MAX L:

Hi

It is possible to use entry.field in restrict view or ?dit option for one user or group but I need to restrict view/?dit for liste of users or groups. How Can I use restrict view/?dit field option dynamicaly ? In other words how Can I use another Form to set users and groups rectrict view/?dit in a second form ?

Thx


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@MAX L](/t5/user/viewprofilepage/user-id/5204873) and welcome to Atlassian community

Yes, you can restrict edit/visibility dynamically and that is by referring to another field or fields in the mentioned parameters via \[entry.field_name\] notations

However, the field value should be accessible to the form - probably connected to another form via the smart field

Alex

comments: author: MAX L
body: Yes but it seems work only when entry.field used in parameters has one user or group value not when it has list of user or liste of group


author: Alex Medved _ConfiForms_
body: The field expects a comma separated list of values and supports multiple

What do you provide/set?


author: MAX L
body: I provide list with comma separator but it take only first value.... I dont know how to fix that


author: Alex Medved _ConfiForms_
body: Do you mind sharing your configuration or providing an example what does not work for you?

Otherwise I dont know how to help you...


author: MAX L
body: Ok

So, I have 2 forms : Form1 to set users/groups and form2 who have restrected field

Form1 : field1 use to select row, field2 group or user multisect and field3 text

Form2 : field1 which have Form1:field3 as restricted view parameters.

Form1: field3 IS used to convert Form1:field2 values in list comma separated


author: Alex Medved _ConfiForms_
body: Not sure I get that, but here is an example what I was trying to explain in my first comment

<https://recordit.co/TKqp8GcNAM>

Alex


author: MAX L
body: Hi

Your example is similar as I expect but in my case it works with only one user or group in field3. If I have field3 with values "userA, userB" or "groupA, groupB" it doesnt work :(

Its lik? if field restriction view parameter used only first value (userA or group A ,instead userA,userB or groupA, groupB

To explain what I would do, its to have a Form to set user and/or group that have rights to view some fields and use it in a product form in which some fields Can b? read or not based on first form datas...

Rightform : colorfield, users, groups

For each color correspond liste of users or liste of groups

Productform: colorfield, adresse, phone

Phone must b? visible only for users or groups with th? right color in colorfield


author: Alex Medved _ConfiForms_
body: It works for single or multiple groups, no problem

Here is the configuration of my example, you can try importing it and seeing yourself

```
<ac:structured-macro ac:macro-id="ddd76577-27e7-4217-b17a-983136aa70e9" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">Form1</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="549bf5f8-2f3c-452c-805b-4c4333707985" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">text</ac:parameter>
<ac:parameter ac:name="fieldLabel">Restrictions group description</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="c3f1d9b8-73b1-455a-a06d-84e05a3421f5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">restrictions</ac:parameter>
<ac:parameter ac:name="fieldLabel">Restrictions</ac:parameter>
<ac:parameter ac:name="type">securitygroupmulti</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="802a8b31-516a-439a-a519-38549373f27e" 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>
<ac:structured-macro ac:macro-id="7dc8e940-c237-4826-82dc-3879db17ebfa" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">Form2</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="aa8db73c-5deb-448d-98c4-716c41960c72" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="editRestrictions">[entry.restrictedBy.restrictions.asList]</ac:parameter>
<ac:parameter ac:name="fieldName">field1</ac:parameter>
<ac:parameter ac:name="fieldLabel">Field 1</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="e581600b-ab24-40ac-9857-80aeba339887" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">restrictedBy</ac:parameter>
<ac:parameter ac:name="fieldLabel">RetsrictedBy</ac:parameter>
<ac:parameter ac:name="values">[136642868|Form1|text|true||]</ac:parameter>
<ac:parameter ac:name="type">smartselect</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="161ee5b3-702f-4498-a8a7-b22ab34ddd2a" 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>
<p>
<br/>
</p>
```

You will need to change the "restrictedBy" field to point at the Form1 in your page -\> reconfiguring the smart field

Alex


author: MAX L
body: Thanks a lot I will try this.


Tags: confiforms

confluence-server

server