JIRA Issue Collector with custom javascript fields

We're trying to use JIRA Issue Collector with one of our products and we've got a few problems with our custom javascript. We basically just followed the instructions found athttps://confluence.atlassian.com/display/JIRA/Advanced+Use+of+the+JIRA+Issue+Collector but if I set a field using the `fieldValues` property on `ATL_JQ_PAGE_PROPS` it won't be present in the story, even though the custom field is defined for that particular story type. 

Additional information: 
If I make `fieldValues` dynamic (aka a function) I can see it running on page load, but only once. I would expect it to run when a user clicks the 'Provide Feedback' button. Is this behaviour correct? 

I also found that `ATL_JQ_PAGE_PROPS` is undefined in both the iframe and the top frame. 

Any help greatly appreciated!

2 answers

This is how I solved this in a plugin of mine (this instantiates three different issue collectors on the same page):

 

jQuery.getScript("https://xxx/issuecollector.js?collectorId=19153ff3");
jQuery.getScript("https://xxx/issuecollector.js?collectorId=db942931");
jQuery.getScript("https://xxx/issuecollector.js?collectorId=3c52dcd6");


jQuery(document).ready(function() {
	window.ATL_JQ_PAGE_PROPS = jQuery.extend(window.ATL_JQ_PAGE_PROPS, {
		'19153ff3' : {
			triggerFunction : function( showCollectorDialog ) {
				jQuery('#collectBug').click( function(e) { 
					e.preventDefault();
					showCollectorDialog();
				});
			}
			, fieldValues: {
				versions : "10400",
				security : "10003",
				customfield_13502 : "11490"
			}
		}, 
		'db942931' : {
			triggerFunction : function( showCollectorDialog ) {
				jQuery('#collectFeatureRequest').click( function(e) {
					e.preventDefault();
					showCollectorDialog();
				});
			}
			, fieldValues: {
				versions : "10400",
				security : "10004",
				customfield_13502 : "11491"
			}
		}, 
		'3c52dcd6' : {
			triggerFunction : function( showCollectorDialog ) {
				jQuery('#collectSuportRequest').click( function(e) {
					e.preventDefault();
					showCollectorDialog();
				});
			}
			, fieldValues: {
				versions : "10400",
				security : "10000",
				customfield_13502 : "11492"
			}
		}
	})
});

Hi Marcell,

Have you been able to achieve updating the fieldValues aside from the initial loading? I'm facing the same problem..

Thanks,
Nick 

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,096 views 13 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