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

Change field color when another field changed

Hello everybody. I have 2 different custom fields in issue (e.g cF1 and cF2) and I need functionality when I change cF1 the cF2 should changed automatically to another value and should be hilighted with some color. 

I suppose I can use Custom Script Field, where in InlineScript field I can write script which returns the value of cF2 to custom template field, where I can change color of field. 

But:

1. what should I do to change cF2? (Write a custom listener script, which changes cF2 when cF1 changed or I can change cF2 in the Custom Script Field or some other ideas)?   

2. how to write template, which changed field background? (please example) 

1 answer

1 accepted

1 vote
Answer accepted

If you create a Scripted Field, it does not hold any value.

It only renders what you have scripted, on the fly.

 

So if cf2 is outputting a value, based on cf1 value, then if cf1 changes, also the cf2 output will change.

No that tutorial involves javascript, meaning using Jira stock.

 

You just need to create a scripted field, select it's output format (template) "HTML".

Then you can use groovy to calculate the logic and return a html in string format.

 

Example

def returnArg
switch(issue.priority.name){
case "Low":
returnArg = "green"
break
case "High":
returnArg = "red"
break
default :
returnArg="yellow"
break
}
return "<h4 style='color:${returnArg}'>Test me</h4>"

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
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