Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner Workflow read only description Edited

Hello,

I am trying to set the description field to read only, when a specific workflow happens, and switch it back, when another workflow step occours.

I tried the following code with Scriptrunner Workflow functions. I do not see any errors in the History, but it still does not work, the description field stays editable.

 

import com.atlassian.jira.issue.IssueFieldConstants
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

final String fieldName = "description"

getFieldById(fieldName).setReadOnly(true)

 Help is greatly appreciated.

 

Regards

1 answer

1 accepted

0 votes
Answer accepted
Tessa Tuteleers Community Leader Jul 01, 2021

Hi @Patrik , 

If you call the description field like that, it returns a string (the content of the description), and you can't make that read only. 

However, there is another way to tackle this with a behaviour instead of a workflow function: 

  • Create a behaviour and map it to your project(s) / issue type(s)
  • Add the workflow you want to work with as a guide workflow
  • Choose the description field and toggle the "read only" option
  • Add you workflow step as a condition

Strangely enough it will look like the description field is still editable in the issue view (the pencil is still there), but it is not if you try to edit it.

Hope this helps! 

- Tessa

Thank you very much, that did the trick.

Like Tessa Tuteleers likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

119 views 1 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you