Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner Behavior hideTab not working

jgiraldo1 December 5, 2019

I am trying to use a server side script to disable a tab (based on the value of a field). For simplicity, I'll omit how I check the value of that other field and the corresponding conditional.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.issue.fields.screen.FieldScreenTab

FieldScreenTab tab = getFieldScreen().tabs.find {return (it.name.toLowerCase() == "executable")}

hideTab(tab)

When I include the hideTab(tab) the Static type checker says Cannot find matching method Script847#hideTab(com.atlassian.jira.issue.fields.screen.FieldScreenTab) and the rest of the script stops working.

I am sure the tab exists because tab.getName() does properly return the name of the tab I am trying to hide. 

1 answer

0 votes
Antoine Berry
Community Champion
December 6, 2019

Hi @jgiraldo1 ,

Not sure if your method is supposed to work, butaccording to scriptrunner's documentation, you could use 

hideTab(1)

I have been successfully using

hideTab("Name of the tab")

Hope that helps.

jgiraldo1 December 6, 2019

If I this the way I described in the initial posting I see the following error:

groovy.lang.MissingMethodException: No signature of method: Script1.hideTab() is applicable for argument types: (com.atlassian.jira.issue.fields.screen.FieldScreenTabImpl) values: [com.atlassian.jira.issue.fields.screen.FieldScreenTabImpl@1a963a0d] at Script1.run(Script1.groovy:33)

And if I do it simply with hideTab("<Tab Name>") where the Tab Name is "Executable" the error says:

groovy.lang.MissingPropertyException: No such property: Executable for class: Script1


Antoine Berry
Community Champion
December 6, 2019

Could you please screenshot it your behaviours configuration & script ?

jgiraldo1 December 20, 2019

Turns out the jira instance I was working on had an outdated version of the Scriptrunner. Got that updated, and now I can hide tabs.

Like Antoine Berry likes this
dr_ostman May 27, 2020

@jgiraldo1 : can you please tell if "hideTab" also works on View Screens in your instance ?

currently i'm facing the problem, that it only works on edit/create screens.

 

thanks!

jgiraldo1 May 29, 2020

Yes, it does work in the Edit screen. I haven't tried it Create though.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events