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

Disable "create branch" option depending on issue state

I like the "create branch" option, but it is not appropriate in all issue states. There is (in our workflow) no sense in creating a branch for a closed issue, nor for an issue that is not "in progress". We have set some conditions on the transaction from "open" to "in progress", so we cannot use the create branch trigger to move the issue to "in progress". 

 

Is there a possibility to select in which issue states the "create branch" link is visible?

5 answers

You can write a javascript which will check the status of the issue and remove the development panel from the UI . something like the below script . Not tested its just to guide you . You will need to paste the script in the announcement banner . Try on a test instance first

if (AJS.$.("#status-val").value=="Closed")
{
    AJS.$.("#viewissue-devstatus-panel").remove()
}

Sounds like a promising way forward, but I'd have to learn javascript first to get it to work...

But this will remove the entire dev panel, is there a way to remove only the "create branch" link?

The syntactically correct version is

if (AJS.$("#status-val").text() == "Closed")
	{   AJS.$("#viewissue-devstatus-panel").hide()
	}

But in reality, it doesn't work.

It does hide the panel during the initial time while the bug information is refreshing, but at the end the panel is shown back again. Maybe there is another script running after that that rebuilds it.

So it's still unresolved.

We need this capability, but until now, I don't have any better idea how we can do it.

If someone knows, please advice

here is sample js code to hide create branch link if user not assigned or status not valid

 

<script type="text/javascript">

$( document ).ready(function() {
var devtoolsDoms = AJS.$("a.devstatus-cta-link");
if(devtoolsDoms === null || devtoolsDoms === undefined) return;
var createBranchDom = devtoolsDoms[0];
if(createBranchDom === null || createBranchDom === undefined) return;
var issuestatus = createBranchDom.attributes["data-issue-status"];
var isassignee = createBranchDom.attributes["data-is-assignee"];
if(issuestatus === null || issuestatus === undefined) return;
if(isassignee === null || isassignee === undefined) return;
if( (issuestatus.value !== "Todo" && issuestatus.value !== "In Progress" ) || isassignee.value !== "true") createBranchDom.style.display="none";
else createBranchDom.style.display="block";
});

</script>

 

<script type="text/javascript">

$( document ).ready(function() {
var devtoolsDoms = AJS.$("a.devstatus-cta-link");
if(devtoolsDoms === null || devtoolsDoms === undefined) return;
var createBranchDom = devtoolsDoms[0];
if(createBranchDom === null || createBranchDom === undefined) return;
var issuestatus = createBranchDom.attributes["data-issue-status"];
var isassignee = createBranchDom.attributes["data-is-assignee"];
if(issuestatus === null || issuestatus === undefined) return;
if(isassignee === null || isassignee === undefined) return;
if( (issuestatus.value !== "Todo" && issuestatus.value !== "In Progress" ) || isassignee.value !== "true") createBranchDom.style.display="none";
else createBranchDom.style.display="block";
});

</script>
0 votes

Hello,

Thank you for all your feedback and suggestions about this matter.

As we understand that this would be a useful feature for JIRA, we created the following feature request to get it implemented through JIRA UI:

Disable "create branch" option depending on issue status 

Feel free to vote and watch the suggestion to increase its priority and also receive notifications about any updates.

We hope to have a nice tracking of how many users are requiring this functionality and put some effort to get you with any options to configure it. Thanks!

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