Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×So, I've tried the "Hiding Menu Button Using JavaScript" from this scriptrunner doc.
And it not only does not hide the clone button, it instead hides the sidebar on issues.
We are running Jira 8.20.9, I've tried it before, i think on 8.13 and it worked. Did the functionality stop working because of jira update? Is the doc no longer valid?
Could you please share the previously working fragment code and a screenshot of your fragment configuration so I can review it?
Also, what is the current version of ScriptRunner that you are using?
Thank you and Kind regards,
Ram
(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) {
hideSAPTransition();
}
});
hideSAPTransition();
});
function hideSAPTransition() {
var projectKey = "HI";
var issue = JIRA.Issue.getIssueKey();
if (typeof (issue) !== "undefined") {
var currentProject = issue.substr(0, issue.indexOf('-'));
if (currentProject == projectKey) {
$("#action_id_1081").hide(); //do not click action for sap transition
}
}
}
})(AJS.$);
I also tried the atl.general contex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you set the path where your javascript is stored using the setenv.sh / setenv.bat file as mentioned in the Adaptavist Documentation?
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For this you have to use Script Fragment feature of Script runner. In Script Fragment use "Hide System or Plugin UI element".
In Hide What section, select clone-issue only
In Condition Block , enter the condition based on your requirement :-
import com.atlassian.jira.component.ComponentAccessor
if(jiraHelper.project?.key == "PROJECTKEY") {
false
} else {
true
}
Hope it Works for you!
OR
you can check this link :- https://mraddon.blog/2017/03/30/how-to-remove-the-clone-option-in-jira-projects/
Thanks,
V.Y
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, the clone option was not really the point. I'm not trying to hide clone option but something else, the script is just slightly modified clone option so I figured to say it's that.
The point is, is that these kinds of fragments break jira ui
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 is to Hide Clone option from Menu and it doesn't break jira UI.
If you apply web panel at wrong location in that case it might break Jira UI.
Hide UI elements only hide options and nothing else.
There are multiple script fragment types which one your tried ?
May i know your exact purpose for using script fragment ?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Like I said in my original message, I used the exact script from "Hiding Menu Button Using JavaScript" section of this article along with other instructions provided for it
And as seen in the screenshot, it does break Jira UI. Disabling the script fixes the issue, so the obvious conclusion is that this functionality breaks the Jira UI.
My exact purpose is to hide one workflow button(we do NOT want to do this through workflow conditions). It was working before jira upgrade but stopped after it. I figured something might be wrong with my script and I applied the one provided by adaptavist to check it out that way, turns out it doesn't work with it either.
The only differences between my script and the one in the wiki is changed project key and instead of hiding clone button it does
$("#action_id_1081").hide();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ram Kumar Aravindakshan _Adaptavist_ Kindly help Jakub regarding Script Fragment.
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.