Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner Workflow read only description

Patrik July 1, 2021

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 1, 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

Patrik July 1, 2021

Thank you very much, that did the trick.

Like Tessa Tuteleers likes this

Suggest an answer

Log in or Sign up to answer