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

Lior Pesoa January 25, 2015

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

1 vote
Lior Pesoa January 25, 2015

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)
}

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 25, 2015

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

Lior Pesoa January 25, 2015

Thanks! :)

Suggest an answer

Log in or Sign up to answer