How to hide Remaining Estimate based on issuetype

Michael Shechter June 29, 2019

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.

 

4 answers

1 accepted

3 votes
Answer accepted
Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2019

then add a behaviour and write in initialiser

getFieldById("timetracking_remainingestimate").setHidden(true)

with proper mapping you can do it for needed issuetypes. 

Michael Shechter June 30, 2019

@Ilya Turov  Thank !!

Jay Karmarkar August 19, 2021

Hi @Ilya Turov,

Thank you for your response. We had a similar requirement and it worked for us, but it removed the remaining estimate field from everywhere on that particular issue type including the log hours screen as well.

Is there a way we just remove it just from create/edit screen but keep it on the screen where we log hours?

0 votes
Nejjari Noureddine January 15, 2020

Hi

I use ScriptRunner to hide timetraking for all users that are not in "developer role" for any project in my JIRA.


Unfortunatly, they can still see the "Original Estimate " and "Remaining Estimate" fields when opening any issue edition screen

In the "Hide What" section of "fragments" configuration, i added "com.atlassian.jira.jira-view-issue-plugin:timetrackingmodule"

And there is my Script :

#########################################################"

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager

//Issue issue = issue
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def roleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def projectRole = roleManager.getProjectRole("Developers")

//if project role Administrators does not exist return false
if (!projectRole)
return false

//will return true or false if the user is in Administrators role
def isInRole = roleManager.getProjectRoleActors(projectRole, issue.getProjectObject())?.getApplicationUsers()?.contains(user)

return isInRole

#########################################################"

0 votes
parthiban_selvaraj September 12, 2019

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 

Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2019

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
parthiban_selvaraj September 14, 2019

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

Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2019

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
parthiban_selvaraj September 16, 2019

Hi @Ilya Turov ,

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

0 votes
Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2019

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" 
Michael Shechter June 30, 2019

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  

Suggest an answer

Log in or Sign up to answer