how can i make summary field editable only for certain role

Mahdi Challouf November 7, 2019

I want to make restriction for edit summary field to be editable only for same roles for the whole projects.

 

I used behaviours to make the field readOnly with expect condition to that role it works but it will be restricted for the whole (Create, view and edit). 

 

There is another way to do this ? 

2 answers

2 accepted

1 vote
Answer accepted
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2019

Hi @Mahdi Challouf

Below snippet will do the trick for you on create screen, just include your user role condition along actionName in If or inside if

if(getActionName() != "Create"){
       getFieldById("summary").setReadOnly(true)
}

 

BR,

Leo

Mahdi Challouf November 7, 2019

Hi @Leo thank you for your help it works too ;) 

1 vote
Answer accepted
Ivan Tovbin
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.
November 7, 2019

Hi Mahdi,

There's a way to achieve this. Not the most elegant solution, but it works.

1) Remove 'Summary' field from issue 'Edit' screen

2) In your workflow create a GLOBAL transition, that lead to ITSELF. That way it will be available in every status, but won't change the current status once used.

3) Add a screen to that transition with 'Summary' field

4) Add all neccessary conditions to that transition, to make it available only to certain project roles.

Now your 'Summary' field will be editable ONLY through that transition. Transition conditions will make sure it's only available to required project roles.

Hope this helps.

Mahdi Challouf November 7, 2019

Hey Ivan,

This will work, but it's huge stuff I have many projects with different workflows certainly there is another optimized solution using scriptrunner or bevaiours that's why I'm asking the question 

Ivan Tovbin
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.
November 7, 2019

Behaviors could be the solution, but it'll require some fine tuning, like specifying actions (screens) where you want 'Summary' to be editable for everyone (like Create screen). Other than that I don't really see a problem with behaviours. Please let me know if you need help with the code.

Mahdi Challouf November 7, 2019

Yes, I'm focusing on behaviours, i added a behaviour to the summary filed I make it read-only with a condition for some roles and I mapped for all the projects the problem now I didn't get the part to make this happen only on the edit screens because in this way even when you create the issue you must be part of the role users.

Do I'm on the right way? 

Ivan Tovbin
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.
November 7, 2019

You are doing it almost right. You need to check that this is NOT a 'Create' transition:

if (getAction().getId() != 1){
.....
}

1 is always the ID of 'Create' transition. 

Like Mahesh Kallepalli likes this
Mahdi Challouf November 7, 2019

Thank you very much, Ivan, it works fine ;)

Suggest an answer

Log in or Sign up to answer