JS to set custom field based on a Project

I would like to set a custom field in the create issue form based on the selection of the project, i.e. if project selected is X, then customfield should be A.

Anyone knows a simple JS (jquery) trick to achieve this?

Thanks in advance.

2 answers

1 accepted

try with javascript by adding in any plugin as a webreource or footer.jsp

<script type="text/javascript">
jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
function setDefaultValues(){
	$("#project").change(function() {
	function setFieldValue(){
		var currentProject=$("#project option:selected").text();
		if(currentProject == 'Test Project'){


check here to know how to add in plugin


Thanks, this works fine.

why you want to do it through JS/Jquery?

you can achive this by using configuring screen scheme for project and you can remove field from create screen, check this document to configure screen scheme


still if you want to do this by using JS, let me know and it is not suggestable

What I need is that if I choose project A in the issue create screen, one customfield in that screen picks automatically a given value, so I don't have to set it manually.

The reason for this is that for that project that custom field is always the same, but for other projects it may change.

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 ...

3,265 views 14 20
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