Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

222 views 2 1
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