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

Set fieldValues in JIRA Issue Collectors

I'm trying to add components to my issues collectors. The code I have right now, with multiple collectors on the page, is as follows:

window.ATL_JQ_PAGE_PROPS =  $.extend(window.ATL_JQ_PAGE_PROPS, {
	'149274e9' : {
		"triggerFunction": function(showCollectorDialog) {
			jQuery("#buttonOne").click(function(e) {
				e.preventDefault();
				showCollectorDialog();
			});
		},
		"fieldValues": {
			components: 'Tableau'
		}
	},
	'60a5609a' : {
		"triggerFunction": function(showCollectorDialog) {
			jQuery("#buttonTwo").click(function(e) {
				e.preventDefault();
				showCollectorDialog();
			});
		},
		"fieldValues": {
			components: 'Tableau'
		}
	}
});

Do the components need to be Component IDs or something? Anything special with any other fields?

Can you remove 'required fields' from the Issue Collectors and set them with javascript? I couldn't figure that out.

Any help is greatly appreciated!

4 answers

1 accepted

1 vote
Answer accepted

Yes, you have to reference the components by id (as String). And since they are components (plural), you have to use an array as well. Like so:

fieldValues: {
    components: ['12345'] // "12345" being the id for component "Tableau"
}

An yes, you also have to set all required fields for the particular field configuration used in your project. That most certainly will include the priority, again referenced by id. Like so:

fieldValues: {
    priority: '3', // required field, '3' could be "Major"
    components: ['12345']
}

I don't know how to set the epic link.

Thanks a lot Andreas! The Epic Link, as it turns out, is considered a custom field. What I did to find it was just open a 'Create Ticket' page and check the ID associated with it there. So now, I have the following for Epic Link:

fieldValues: {

customfield_xxxxx: 'EP-123'

}

with JIRA on demand 6.4-OD-05-009, i was never able to get hidden input values to successfully save when a ticket is created via my issue collector.  

if i add the fields to the issue collector form (via the admin in jira), and set them in JS, they pre-populate when the issue collector for opens, and save correctly.  

if the fields are not on the issue collector form however, the values set in the JS don't get recorded in the issue collector ticket.  if i inspect the form, i can see them populated as hidden values.  and i can see them on the request headers to JIRA as well.  but the values are empty on the resulting ticket.  i was testing with priority and component.

any advice or thoughts as to why?  perhaps a full example would help.

thanks.

Also epic links if possible. :)

Thanks a lot Andreas! The Epic Link, as it turns out, is considered a custom field. What I did to find it was just open a 'Create Ticket' page and check the ID associated with it there. So now, I have the following for Epic Link:

fieldValues: {

customfield_xxxxx: 'EP-123'

}

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Off-topic

Run into these Solution Partners at Atlassian Open

Hey there Community! Atlassian Open is kicking off in less than a month and we can't wait to touch down in Vienna, Sydney and Boston. This is an opportunity to create the future of teamwork with ...

83 views 0 4
Read article

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