Dynamic field values in Jira issue collector

Aviram Gabay
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.
April 1, 2014

Hi Team,

I've added a link to comments action in Confluence using web-item in the plugin xml.
This new link openes a Jira issue collector dialog.

I would like a text field in the dialog to be prepopulated with the comment details (or just comment id).

Is this possible?

Edit: I know that according to the documentation you can't do it, the field values are populated only during page load and not when dialog opens, but I was wondering if there was a workaround.... Assuming my Confluence and Jira are on different sub-domains

Thanks

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Alan March 11, 2016

I was also hit by this problem (cannot update the default values once the collector is loaded) which I solved by putting the ajax call and the default parameter code into the click handler of a custom trigger. It basically loads and builds the collector every time the trigger is clicked. A global object is then referenced in the default value to fetch the most recent values.

0 votes
Alan June 22, 2016

This should be the minimal excerpt to make it work, there is also a timed check to ensure network latency does not break it.

 

globals.collector_test = function() {
            if ( undefined != globals.open_data_collector ) {
                clearInterval(globals.collector_test_interval_id);
                setTimeout(globals.open_data_collector,0);
            }
        }

        globals.click_handler = function(e) {
            jQuery.ajax({
                url: "https://my-server/jira/link-to-collector",
                type: "get",
                complete : function() { globals.collector_test_interval_id = setInterval(globals.collector_test,500);},
                cache: true,
                dataType: "script"
            });

            window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {
                '6b808d35' : { 
                    "triggerFunction": function(showCollectorDialog) {
                        globals.open_data_collector = function(e) {
                            showCollectorDialog();
                        };
                    },
                    
                    fieldValues : { 
                        customfield_10401 : globals.form_data ,
                    },
                }
            });
        }
Ertan June 26, 2016

Thanks for sharing this Alan. Cheers

0 votes
Ertan June 22, 2016

Hi Alan, do you have an example of your code?

TAGS
AUG Leaders

Atlassian Community Events