JIRA 6.0 javascript differentiate "Create Issue" dialog and "Assign" dialog

Hi there,

I've a java script embeded to assignee field's description as follow:

<script type="text/javascript">

jQuery(document).ready(function($) {

function hide() {

$("#assignee").closest('div.field-group').hide();

}

hide();

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context) {

hide();

});

});

</script>

This were working fine when I try to create an issue.

Apparently, once the issue being created, when I click on "Assign", the "Assignee" field were also dissappeared.

Anyway in the javascript to differentiate "Create Issue" screen/dialog and "Assign" screen/dialog?

Thanks.

2 answers

1 accepted

try with this

&lt;script type="text/javascript"&gt;

jQuery(document).ready(function($) {

function hide() {
	var creteButton = document.getElementById('create-issue-submit');
	if(creteButton != null  &amp;&amp; creteButton.value =='Create' ){	
		$("#assignee").closest('div.field-group').hide();
	}else{
		$("#assignee").closest('div.field-group').show();
	}
}

hide();

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context) {

	hide();

});

});

&lt;/script&gt;

Thanks. The suggested way works...:)

Hi,

You can do, try to fetch the button value that is present in the create screen, the id will be like create-issue-submit and the value will be create issue, Add a if block in your code check for that condition and then execute it.This will work.

if($("#create-issue-submit").val()=="Create issue"){

// your code here

}

Hope this Helps.

thanks for the solution, the val() should be "Create" instead.

cheers...:)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,739 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot