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

How to hide Remaining Estimate based on issuetype Edited

Hello,

i'm want to hide only   Remaining Estimate field (Original Estimate should be available )   based on issueType on Create or other transition screens

how can i do it using js or script  runner

Thanks.

 

3 answers

1 accepted

1 vote
Answer accepted

then add a behaviour and write in initialiser

getFieldById("timetracking_remainingestimate").setHidden(true)

with proper mapping you can do it for needed issuetypes. 

You can hide the time tracking element using Scriptrunner's Hide UI Element 

The element to hide is called "com.atlassian.jira.jira-view-issue-plugin:timetrackingmodule"

Also note that "condition" is about when you want to show the item, so if you want to hide it only for issue type called "Bug" (and display for other) you write

issue.issueType?.name != "Bug" 

thanks Ilya, but i  want to hide only  Remaining Estimate and Original Estimate should be available. im talking about field in the create screen or transition screens  

Hi @Ilya Turov ,

I want to hide clone option. Below are my scenario

1) Project = "AAA" and Except users (AA,BB,CC,DD) clone option should disabled.  My Code

import com.atlassian.jira.component.ComponentAccessor

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def userUtil = ComponentAccessor.getUserUtil()

!(jiraHelper.project?.key =="AAA")
if(currentUser.getUsername() in ["AA","BB","CC","DD"])
{
return true
}

My Code are not working. Did I missed anything ? 

 

CC @Alexey Matveev @JamieA 

I'm honored to be in same mentions with such refined lads, but seriously speaking, if you want to hide the "clone issue" button you can't do it with behaviours, guess you are doing it using "script fragments" - "hide UI element", in this case

Note that the item will be displayed if the code returns a truthy object.

and I feel like your code might look like this:

import com.atlassian.jira.component.ComponentAccessor

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def shouldBeDisabled = jiraHelper.project?.key =="AAA" && currentUser.username in ["AA","BB","CC","DD"]

return !shouldBeDisabled

Hi @Ilya Turov ,

Yes am Updating in Web Fragements. 

 

Your script is working, but the problem is not resticting in all Jira Projects. My goal is to restrict to few projects and other porjects all users should have Clone option.

 

Regards,

Parthiban

well, what was left is to play with conditinos a bit:

import com.atlassian.jira.component.ComponentAccessor

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def shouldBeShown = jiraHelper.project?.key !="AAA" || currentUser.username in ["AA","BB","CC","DD"]

return shouldBeShown
Like parthiban.selvaraj likes this

Hi @Ilya Turov ,

Thank you very much. :) :) :) It worked well as expected.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

886 views 7 24
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