JIRA Pass Values to Issue Collectors

I'm using the JIRA toolkit plugin to include customfields, that have issue collectors within them.  I use the issue key and summary of the issue that you're viewing to link the issues and to prepopulate the summary of the issue being created via the issue collector.  

I've run into a problem that when you search for issues, then click on one, neither the key or summary are being populated; however, if I refresh the page, the issue key and summary are populated.  I've tried the following:

<script>
var key = AJS.$("#key-val").text();
var smry = AJS.$("#summary-val").text();
</script>

I've tried using the getMeta one as well, but the same problem applies.  I've put the above in the banner of the page hoping that would load it up but that doesn't help either.  

If you hit the Issue page directly, you can get the values.  If you come in from search, you can't.  

Code looks like this:

<script type="text/javascript" src="https://jira.cool.com/s/7b1d48e5a4bf9676ea0ff3658b54a4bc-T/en_USmkuci8/71010/4c9339008042d3c77aa255f56856528f/2.0.14/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=68d49fe7"></script>
<script type="text/javascript" src="https://jira.cool.com/s/7b1d48e5a4bf9676ea0ff3658b54a4bc-T/en_USmkuci8/71010/4c9339008042d3c77aa255f56856528f/2.0.14/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=0dddf2e5"></script>
<script type="text/javascript" src="https://jira.cool.com/s/7b1d48e5a4bf9676ea0ff3658b54a4bc-T/en_USmkuci8/71010/4c9339008042d3c77aa255f56856528f/2.0.14/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=cebf2eea"></script>
<script type="text/javascript" src="https://jira.cool.com/s/7b1d48e5a4bf9676ea0ff3658b54a4bc-T/en_USmkuci8/71010/4c9339008042d3c77aa255f56856528f/2.0.14/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=cd59e731"></script>
<script>
var key = AJS.$("#key-val").text();
var smry = AJS.$("#summary-val").text();
window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {
'68d49fe7' : {
triggerFunction: function( showCollectorDialog ) {
$('#xb').click( function(e) {
e.preventDefault();
showCollectorDialog();
});
},
fieldValues: {
summary : ['A: '+key+' - '+smry],
'issuelinks-linktype' : ['relates to'],
'issuelinks-issues' : [key]       	
}
},
'0dddf2e5' : {
triggerFunction: function( showCollectorDialog ) {
$('#xc').click( function(e) {
e.preventDefault();
showCollectorDialog();
});
},
fieldValues: {
summary : ['B: '+key+' - '+smry],
'issuelinks-linktype' : ['relates to'],
'issuelinks-issues' : [key]       	
}
},
'cebf2eea' : {
triggerFunction: function( showCollectorDialog ) {
$('#xd').click( function(e) {
e.preventDefault();
showCollectorDialog();
});
},
fieldValues: {
summary : ['C: '+key+' - '+smry],
'issuelinks-linktype' : ['relates to'],
'issuelinks-issues' : [key]       	
}
},
'cd59e731' : {
triggerFunction: function( showCollectorDialog ) {
$('#xe').click( function(e) {
e.preventDefault();
showCollectorDialog();
});
},
fieldValues: {
summary : ['D: '+key+' - '+smry],
'issuelinks-linktype' : ['relates to'],
'issuelinks-issues' : [key]   
}
}
});
</script>
<button id="xb" class="aui-button">A</button>
<button id="xc" class="aui-button">B</button>
<button id="xd" class="aui-button">C</button>
<button id="xe" class="aui-button">D</button>

Any help is greatly appreciated.

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

763 views 2 19
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