Hi,
Does anyone know if it is possible to use the new Web Fragments feature of ScriptRunner to alter the UI to prevent issue cloning in just 1 project? And if so, how?
Thanks in advance
Conor
Hi Conor,
Our latest release includes a built-in script to allow you to conditionally hide UI elements (like the Clone button):
https://scriptrunner.adaptavist.com/4.1.3.16/jira/fragments/HideUIElement.html (for JIRA 6.3/6.4)
https://scriptrunner.adaptavist.com/4.3.5/jira/fragments/HideUIElement.html (for JIRA 7.x)
I hope you like it.
regards, Mark.
Thank you Mark! This is exactly what i needed.
I've implemented this for 1 of our projects and it works great!!
Super support as always from you guys
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm having some difficulty in finding how to get to go to Admin → Script Fragments
can you help me find it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure thing: please try the Jira Admin (cog) --> Add-ons then find the ScriptRunner section and finally choose Script Fragments.
Alternatively you could try using "." (or even "g+g" or press g twice) and then type "Script Fragments".
I hope that helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Not sure if you already implemented this.
1. Click on Hide system or plugin UI element
2. type com.atlassian.jira.plugin.system.issueoperations:clone-issue in what to hide (Module key)
3. Put this condition !(jiraHelper.project?.key == "Project_Key")
Save
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The following script should hide "Clone" menu item for one project only. Tested in JIRA 7 and works fine.
Select ScriptRunner "Script Fragments -> Install web resource". Provide details [screenshot attached]:hide-clone.png
You can also check ScriptRunner web resources from here: https://scriptrunner.adaptavist.com/latest/jira/fragments/WebResource.html
The javascript file "hide-jra.js" contains the following code:
(function ($) { $(function () { /** * Binding is required for link such as * http://localhost:8080/jira/projects/JRA/issues/JRA-4?filter=allopenissues */ JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(event, $context, reason) { if (reason === JIRA.CONTENT_ADDED_REASON.pageLoad || reason === JIRA.CONTENT_ADDED_REASON.panelRefreshed ) { hideCloneMenuItem(); } }); //calling function for link such as: http://localhost:8080/jira/browse/JRA-5 hideCloneMenuItem(); }); /** * Hide the clone menu */ function hideCloneMenuItem() { var projectKey = "JRA"; var issue = JIRA.Issue.getIssueKey(); if (typeof (issue) !== "undefined") { var currentProject = issue.substr(0, issue.indexOf('-')); if (currentProject == projectKey) { $("a#clone-issue").hide(); } } } }) (AJS.$);
I have used project key "JRA" for this example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashraful,
I have the following based on your answer above -
Unfortunately this does nothing (other than not throw an error, which at least confirms it's picking up my resource directory).
I'm running JIRA 6.4.7 (our org. is not able/ready to upgrade to JIRA 7 just yet)
Any ideas?
Kind regards
Conor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi - the script has been updated and it works fine in JIRA 6.4.7. I have removed "AJS.toInit" from 2nd line. After uploading the script you may need to restart the JIRA instance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.