Set behavior script to show 'linked issues' field only if 'resolution' is set to 'duplicate'

Hi,

 

I tried to change the following behavior script that when in 'resolved' screen of a bug and choosing 'resolution' as 'duplicate' it will only then show the 'linked issues' field.

 

here is the original behavior code:

public void setPriorityJustification() {
    FormField priField = getFieldById ("priority")
    FormField priJustField = getFieldByName ("Priority Justification")
    String priority = (String) priField.getFormValue()
    if (priority == "1") { // 1 is Blocker
        priJustField.setHidden(false)
    }
    else {
        priJustField.setHidden(true)
    }
}
Thanks!

1 answer

I have found the solution

But now i see the 'linked issues' field for a second before it disappearing. any option not to show it at all until you choose 'Duplicate' ?

Here is the script:

FormField res = getFieldById(getFieldChanged())
FormField links = getFieldById("issuelinks")
if (res.getFormValue() == "3") { // duplicate
links.setRequired(true).setHidden(false)
if (! links.getFormValue()) {
links.setHelpText("Please enter the duplicated issue.")
}
}
else {
links.setHelpText("")
links.setRequired(false).setHidden(true)
}

I'm afraid not - the script executes after the browser renders the screen (it has to)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,795 views 11 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot