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
Accepted answer

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
Posted 2 hours ago in Off-topic

Friday Fun: The soundtrack of your life

Music, at its essence, is what gives us memories. And the longer a song has existed in our lives, the more memories we have of it   -  Stevie Wonder   This week's Friday Fu...

22 views 0 2
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