Jira Issue Collector: modifying trigger button to call the collector feedback form

Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2019

Howdy,

I am trying to modify the default trigger button that calls the collector form from a Confluence page.

I am not into development and web development specifically, so most of JavaScript stuff is all greek to me. I'd appreaciate your help greately.

So I have created a new Collector in Jira and set the trigger to Custom.

Then I have added a Markdown macro to the Confluence page where I want to modify the trigger button. The macro should allow me to inject JavaScript into the page.

Inside the Markdown macro I have added the following script:

 <script src="https://code.jquery.com/jquery-latest.js"></script>
 <script>
	jQuery.ajax({
    url: "https://example.net/jira/s/9513b004b8a6dcfc358427f3364b533d-T/
-786kzr/76010/be09033ea7858348cd8d5cdeb793189a/2.0.27/_/download/batch/
com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/
com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?
locale=en-UK&collectorId=1cba1cab", type: "get", cache: true, dataType: "script" }); window.ATL_JQ_PAGE_PROPS = { "triggerFunction": function(showCollectorDialog) { jQuery("#myCustomTrigger").click(function(e) { e.preventDefault(); showCollectorDialog(); }); }}; /* Tried this one as well, but no cigar window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, { // ==== custom trigger function ==== triggerFunction : function( showCollectorDialog ) { $('#feedback-button').on( 'click', function(e) { e.preventDefault(); showCollectorDialog(); }); // add any other custom triggers for the issue collector here } }); */ </script> <body> <h2>JIRA Issue Collector Demo</h2> <a href="#" id="feedback-button" class='btn btn-primary btn-large'>Report feedback</a> </body>

However, when I click the Report Feedback link-button, nothing happens, Jira Issue Collector's form does not show up.

What am I doing wrong here? TIA.

7 answers

1 vote
David Vasandani May 7, 2019

For anyone else that finds this issue, closing following this SO article resolved my issue.

https://stackoverflow.com/questions/44673689/window-atl-jq-page-props-in-jqgrid

0 votes
Deleted user January 23, 2022

If you have adblock try to disable it

0 votes
David Vasandani May 7, 2019

@Stan Ry Can you post your full script? I've tried piecing together your original post and your solution but it isn't working for me. This is for a Classic Project in JIRA Cloud that supports Issue Collectors if that makes a difference.

0 votes
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2019

I wonder why isn't it suggested in the official docs? Uhm... Or are there any other ways to workaround the delays and make it so the button to which you assign opening of the Issue Collector form is always clickable?

0 votes
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2019

Okay, the issue is ridiculous.

If Jira cannot be immediately accessed, the trigger function doesn't fire on time. To work this around I had to add a timeout:

<script type="text/javascript">
$(document).ready(function(){
window.ATL_JQ_PAGE_PROPS = {
"triggerFunction": function(showCollectorDialog) {
var intId = setInterval(function(){
if($('#myIssueTrigger').length>0){
jQuery("#myIssueTrigger").click(function(e) {
e.preventDefault(); showCollectorDialog();
});
clearInterval(intId);
}
},500);
}}; });
</script> 
0 votes
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2019

Any other ways to trace down the issue?

0 votes
Johan Soetens _Dumblefy_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2019

I'd suggest first having a look for errors in the Console.

Chrome DevTools - Console

Johan Soetens _Dumblefy_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2019

The code you pasted also has a different id (feedback-button vs  myCustomTrigger)

Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2019

@Johan Soetens _Dumblefy_

Hi Johan,

Thanks for your response. That's a glitch here. I was using the custom code, then forgot to modify it for this post.

Unfortunately, the ID name doesn't seem to be the cause. Here's the screenshot:

 

 chrome_2019-01-16_11-40-36.png

And there's the console output:

 

 chrome_2019-01-16_11-41-26.png

No visible issues whatsoever.

What could it be? I am running out of ideas...

Thank you in advance.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events