Hi,
I'm attempting to write a simple Script Runner Behaviour to hide a specific tab (let's call it "details-tab") based on the issue type...with no success!
I did (unfortunately) manage to blow away the tab by calling tab.remove() in the final IF statement below - so I know the process to identify the tab works just not the disableTab or hideTab calls?
Any ideas what I'm missing ??
import com.atlassian.jira.issue.fields.screen.FieldScreenTab
def issuetype = underlyingIssue?.getIssueType().name
if (issuetype?.toLowerCase() == "document update") {
FieldScreenTab tab = getFieldScreen().tabs.find {
return (it.name.toLowerCase() == "details-tab")
}
if (tab) {
//hideTab(tab)
disableTab(tab)
}
}
Thanks in advance
Hi Garry!
I believe that you are very close. I tested this code on a Behaviour on my instance and it works for me:
def issueType = getIssueContext().getIssueType().getName()
FieldScreenTab tab = getFieldScreen().tabs.find {
return (it.name.toLowerCase() == "test")
}
if (issueType == "test") {
if (tab) {
hideTab(tab)
}
} else {
showTab(tab)
}
I used it in a Behaviour on the Issue Type field, but it would also work as an Initializer.
Thanks Carmel but still Nope - my Behaviour just doesn't work. I've set it up as an Initialiser and also tried Adding a Field (i.e. the Issue type field) as you mentioned but still no change to the Jira Form (its tabs); I do get the correct logging being produced though.
I've even reduced my code down to the bare essentials:
log.info("Disabling tab")
hideTab(2)
log.info("Tab Hidden")
Both messages appear in the log after refreshing the Browser but the number of tabs never changes?
I've just updated the Script Runner plugin to v5.4.43 and no change...
Any ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmmm. Sounds like something else is going on with this Behaviour. Do you have any other Behaviours (or Listeners, Post functions, etc) that could be acting on this tab or screen?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Carmen,
I think you hit the nail on the head ...
I have 4 Behaviours setup but one of them did not have a Mapping (Project/Issue Type etc). Once I set that all the Behaviours are now working !
A trap for young players no doubt :-)
Thanks for you help!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Gary! If that answer helped you, could you please mark it as accepted so others can see this question was solved and it could possibly help them? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.