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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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 behaviour - Prevent Fix Version updates during multiple statuses Edited

I have tried a few methods, but I'm unable to prevent the Fix Version/s field from being edited in about 4 statuses.  I've created a Behaviour and tried the following conditions (at different times), but neither are preventing edits to the Fix Version/s field.

When : Workflow Step <status 1>
            Workflow Step <status 2>
            Workflow Step <status 3>
            Workflow Step <status 4>

 &

Except: Workflow Step <status 5>
            Workflow Step <status 6>
            Workflow Step <status 7>
            Workflow Step <status 8>
            Workflow Step <status 9>
            Workflow Step <status 10>

 

The Behaviour is mapped to All Issue Types & a few projects.  The workflow steps would also span multiple workflows.

I have another Behaviour preventing a custom field from being edited by project role, not status.  I tried disabling that to see if they were conflicting with each other, but no luck.

3 answers

Hi @Shannon Bennett ,

 

See if these two links below could help you to achieve your goal:

https://library.adaptavist.com/entity/set-behaviour-read-only 

https://scriptrunner.adaptavist.com/5.0.2/jira/recipes/workflow/get-workflow-vars.html 

Try to use if-else statements in your Behaviour to set the setReadOnly() method as true or false and determine which status the field can or cannot be edited.

 

I hope this can help you.

 

BR,

Alexandre de Sousa.

Behaviours will not work on the "View screen", rather if a field is "affected" by a behaviour and a user tries to edit it, it will direct them to the Edit screen instead where the Behaviour should work.

 

Could you show us the behaviour implementation -- the settings and conditions?

Could we eliminate this being a bug by setting the fixVersion field read-only at all times, in some sample project? Just to see if it will work regardless of the status.

0 votes
Leo Community Leader Jan 01, 2021

Hi @Shannon Bennett,

I have tested below code in my sandbox by adding it as server-side script for fix versions field in behaviour 

def fVersions = getFieldById("fixVersions")
def status = underlyingIssue?.getStatus().name
if(status == "To Do"){
fVersions.setReadOnly(true)
}else{
fVersions.setReadOnly(false)
}  

Hope this helps 

 

BR,

Leo 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.10.0
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,158 views 8 28
Join discussion

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