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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

82 views 0 5
Read article

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