How to set component from current confluence page name in issue collector?

Malcolm Cook January 5, 2018

I have a Confluence space each of whose pages has a "component" of the same name in a corresponding JIRA project.

I have deployed an issue collector in the footer of the space so it appears on every page of the space.

I would like to set the component of an issue created using this issue collection to be the name of the current page.

Is there a way to perform this?

 

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 8, 2018

I don't think this is currently possible to do.  I will try to explain why that is here. 

So our documentation on the Advance use of the Jira issue collector does explain in some detail how you can set field values in the issue collector trigger itself.   It does not explicitly tell you how to set components though.    As other community users have discovered in threads such as:

https://community.atlassian.com/t5/Answers-Developer-Questions/Set-fieldValues-in-JIRA-Issue-Collectors/qaq-p/464201

and

https://community.atlassian.com/t5/Jira-questions/Pre-set-Component-for-Issue-Collectors/qaq-p/73825

Components cannot be set by their name when using an issue collector like this to specify values, such as 'componentA' or 'componentB'.  Instead, you have to set these based off their internal component ID number (these are usually 5 digit numbers that typically start at 10000 or 10100 and tend to be sequential in the order the component was created).

The hurdle that I can't seem to find a way to get over here is translating the component's name into the component's ID number from within Confluence.  If you could specify the component value by the actual name of the component, then perhaps there is some kind of javascript code that could be hacked out in order to pass that into the collector.  But since component requires an ID number, and Confluence does not really have a means to know or store that ID value, I can't seem to find a way to do this either.

If you knew the ID ahead of time, you could certainly configure the trigger code accordingly on each space, but I'm guessing this would be really tedious to do if you have a lot of components in Jira.   I suspect you are looking for a single bit of trigger code to place on each confluence page that is same so that you don't have to try to create/manage different code for different spaces.

Of course I welcome any other thoughts on how this might be accomplished.

Suggest an answer

Log in or Sign up to answer