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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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.

 

4 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.

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

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

Suggest an answer

Log in or Sign up to answer
TAGS

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