You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I need to disable the 'Assign to me' link when a custom field has a particular value. I have tried using the Behaviour Script - Initializer as well as Server Side Script, with no avail. Script works fine on Create,Edit and Assign screens.
Could you please help.
Thanks and Regards,
Swapnil Srivastav.
Actually you would do it with a script fragment of type "hide element", but the element 'assign-to-me' is not available to hide.
I have a sort of a hack-solution.
You can use a 'Show a web panel' script fragment and inject javascript code to disable the button.
Unfortunately, the button is loaded after the script fragment, so you need to set a delay in your javascript code.
Here is the code:
writer.write('<script>setTimeout(function(){document.getElementById("assign-to-me").style.display = "none"},1000);</script>')
It basically waits for 1 second (for the button to load) and then hides the button.
It's a bit a hack, but the best I came up with.
And this snippet only hides the button on the edit screen. You can still assign the issue by typing 'i'.
The issue will look like this:
And here is a screenshot of the configuration:
And here is a better code snippet without needing the timeout function...
It sets a 'global css rule', which automatically hides the link as soon as that is created.
writer.write("<script>var css = '#assign-to-me { display: none; }', head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style');head.appendChild(style);style.appendChild(document.createTextNode(css));</script>")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Leonard Chew ,
Thank you very much for your response.
I don't need to hide it globally. I need to hide it only for a particular project, only for a particular issue type and on a condition that a custom field has a particular value.
Can that be done using Script Fragments? If yes, could you kindly help me with the Condition part?
Thanks and Regards,
Swapnil Srivastav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This Condition Script will hide the link, if...
Condition Script:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectsByName("Documentation")[0]
def cFieldValue = issue.getCustomFieldValue(cField)
(issue.issueType.name =='Epic' && cFieldValue=='Doc')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can the assign to me link be hidden for specific groups or roles?
I have this in the condition to restrict to a group but it doesn't seem to restrict to group. The "assign to me" link either shows for everyone or nobody.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.