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 Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

465 views 7 5
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