Issue Collector Button on Confluence Macro does not trigger

Teresa Felder July 19, 2017

@Steven BehnkeI have read several different documents and community posts on steps to add a link/button on a single Confluence Page to open a JIRA Issue Collector, using the custom setup on the Collector.

I used an HTML Macro and have all code in place and link text appears. In preview the link works and opens the Collector form.  

However, when I save the page and try to click the link it does not work.  If I right click the link and ask it to open in new tab/page, it opens the same page I am on.

<head>
	

     <script type="text/javascript" src="xx"></script>


	<!-- This is the script for specifying the custom trigger.  'dsuSupportTracker' -->


    <script type="text/javascript">window.ATL_JQ_PAGE_PROPS =  {
	"triggerFunction": function(showCollectorDialog) {
		//Requires that jQuery is available! 
		jQuery("#dsuSupportTracker").click(function(e) {
			e.preventDefault();
			showCollectorDialog();
		});
	}};</script>
	

</head>
 
<body>
	<h1 style="color:blue;">Member Services Support Request</h1>
	</br>
	<h2> 
       <a href="#" id="dsuSupportTracker" class='btn btn-primary btn-large'>Open a JIRA Ticket</a> 
    </h2>

</body>

 I am probably just looking right past the issue, but don't want to keep banging my head against a wall.

 

3 answers

0 votes
munyiva ngea May 6, 2018

Thank you so much reformatted and removed the extra tags and it worked for me.

0 votes
Teresa Felder July 20, 2017

Thanks so much!  Took all the extra tags out and it worked perfect. 

Steven F Behnke
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.
July 20, 2017

Excellent, thanks for updating me! If you could mark my answer as "Solution" then it could help others find the answer in the future. :)

0 votes
Steven F Behnke
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.
July 19, 2017

Okay I believe that the issue is the <head> and <body> tags that you're using. For instance, this works just fine:

<script type="text/javascript" src="https://jira.domain.corp/s/ad9875d0942c8adsf234234ac5447ea108-T/aadfsayy/72009/ff0c9dsafadsf245q49b498536a400ce/2.0.23/_/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=db428328"></script>

    <script type="text/javascript">window.ATL_JQ_PAGE_PROPS =  {
	"triggerFunction": function(showCollectorDialog) {
		//Requires that jQuery is available! 
		jQuery("#myCustomTrigger").click(function(e) {
			e.preventDefault();
			showCollectorDialog();
		});
	}};</script>
<a id="myCustomTrigger" href="#">Trigger</a>

I tried your code and inserted 'console.log("hello world");' into the script. During preview, this did log "hello world" to my browser console. When I saved the page, it did not log anything. When I removed the <head> and <body> tags and saved the page, this did log "hello world" as expected. I think we can make the assumption that the script wrapped in the <head> tag is not executing which explains what you're seeing.

It's not recommended to have multiple head or body tags in an HTML document and it seems to completely break the Confluence UI anyway, my footer was near the top of the screen and none of the buttons worked.

If you need more help, my examples on this previous example should be extraordinarily clear: https://community.atlassian.com/t5/Confluence-questions/How-to-create-a-button-to-open-the-issue-collector/qaq-p/88880.

Steven F Behnke
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.
July 19, 2017

Also, right-clicking and opening in a new page will never work with issue collectors. There's no HTML page to serve up and your trigger has an 'href' of '#'. These links will always resolve to the same page at the root anchor.

<a href="#" id="dsuSupportTracker"

The way the Issue Collector works is all client-side. The <script> that you include downloads web resources from the jira server and attaches a click event to the selected trigger. When you click the trigger, the resources the browser already downloaded show a modal with fields. When you click Submit, the browser fires another click event that sends an AJAX call back to the JIRA server and closes the modal.

Steven F Behnke
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.
July 19, 2017

Just testing something sorry

<a href="#" id="dsuSupportTracker"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events