Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ScriptRunner Behavior hideTab not working

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 Leader Dec 06, 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.

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 Leader Dec 06, 2019

Could you please screenshot it your behaviours configuration & script ?

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

@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!

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
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

209 views 2 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you