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

How to hide the edit button for Closed tickets using announcement banner

badana_teja December 10, 2019

Hi Team,

We have decided to hide the edit button for closed tickets. For that I've put one javascript code in announcement banner below and it's not working well. Could you please assist the right code to hide the edit button based on status.

<script type="text/javascript">
(function($) {
AJS.toInit(function(){
// init on load
project = AJS.Meta.get("issue-key").substr(0, AJS.Meta.get("issue-key").indexOf('-'));

if (project == "xxx") {
AJS.$("a#edit-issue").hide();
console.log("HIDE");
}
else {
AJS.$("a#edit-issue").show();
console.log("VISIBLE");
}
});
})(AJS.$);
</script>

 

Thanks,

Tej

1 answer

0 votes
Alexander Bondarev
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.
December 10, 2019

Hi, @badana_teja !

I strongly recommend you to use workflow properties(jira.issue.editable). 

Look through the documentation.

badana_teja December 10, 2019

I agreed that workflow properties will work definitely, but when we use properties users cannot update the worklogs any more. But we have one scenario, that if user want to change his/her worklogs on that closed tickets then there is no option to modify worklog as that will be also hide as part of edit restriction. So using announcement banner, we can hide only edit button and worklog option will be visible as normal. So please assist on that script to hide edit button for closed status tickets.

Alexander Bondarev
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.
December 11, 2019

Is it popular case? 

For example you can create new group to editors(1-2 users) and use properties like I already sent before: 

jira.permission.edit.group=jira-editors

Yes, they can be able to edit issue attributes too, but it is better than banner in my opinion.

badana_teja December 12, 2019

Yes, it is now popular case. If user want to modify the worklog after closing ticket then there is no option if we put restriction. Also based on this worklogs only the productivity will be calculated. It's not about the editors. I just thinking that only owner of the ticket should log work. If we restrict edit then worklog option also will be unavailable. So our expectation is restricting edit option for closed status tickets and allowing owners to log/modify their worklogs.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events