The following article shows how to hide or show some customfield depends on other field.

This is usefull when you want to set some property or information depends on other field.

Imagine that you have one field called “Colour” and other field called “Variation”.

Imagine that for example the color is Red the variation is not needed because normally…”red is red” or “black is black”.

Imagine that for example the color is blue…in this case maybe the variation is usefull because blue can be “light blue”, “dark blue” or “turqueise!!!” for example.

The following code shows you how to do it with Jira Scriptrunner without using behaviours with a simple and basic trick.

The following link shows the code.

https://github.com/MrAddon/Blog_Examples/blob/master/ScriptFieldJJ.groovy

This example works with the fields: “EscalationType” as “colour”.

And the second field is searching for the linked issues of this issue.

In summary the code is something like:

IF (“First CustomField” == “value” ) => Find the value of second field

ELSE

return NULL

The trick is if you return NULL with the second customField even you have it added to View Screen the field will not be displayed.

 

I hope it helps!

 

 

Posted by:juanjomarchal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s