Hi,
I'm fairly new to Atlassian community, apologies if this has been asked before.
Our specific use case is when summary is created or updated, check if the summary contains any components that exist in the project and if it does then add those components to the ticket, thus essentially automating the addition of components based on the summary. Current workaround is to maintain a static array (as variable) of all project components and branch on that array to check if summary contains those strings. We would like to be able to pull all project components into automation dynamically, so we don't have to maintain a manual list. So my question is how can we use Jira automation to get a list of all components in a given project?
Thanks.
To do that dynamically, you could call the REST API function from the rule using a web request and then parse the response using list and text functions to get the component list.
This will slow down the rule, perhaps by several seconds.
Kind regards,
Bill
Hi @Bill Sheboy
Many thanks for your reply.
Your suggestion has worked a treat!
I have now added an action 'Send web request' to my rule with a 'Web Request URL': https://<company>.atlassian.net/rest/api/3/project/{{project.key}}/components where I am using smart value {{project.key}} to get the project key dynamically. I am then adding 'Advanced branch' for 'Smart value': {{webResponse.body.name.split(", ")}} which enables me to iterate and perform actions on each component in the project, which is exactly what I wanted.
My only remaining question is whether there is any way that this web request can be performed as the user who triggered the rule? Because currently in the web request I am adding 'Authorization' in the Headers with a basic token of a Jira admin account, I would prefer if the web service call can be made using credentials of the triggering user, as they will have access to see components in target project anyway. Just so Jira admin token is not exposed unnecessarily.
Thanks,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
I am glad to learn that helped. At this time I do not believe there is another way to add authorization; there are a few suggestions/requests in the Code Barrel (now part of Atlassian) backlog to add that feature.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill, I will stick with as is basic token Authorization for now in that case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is now a feature suggestion for this JRACLOUD-77766 Option to send a Web request as a user who triggered the rule under the action-Send web request
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that link, Ivan.
Although I am unclear how they would implement that without adding/linking the stored information for the REST API tokens to the Jira user accounts. As it, the credentials would only be visible to the project admin for a rule and site admins. Let's see how that one progresses.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, yes, I guess Jira would somehow need to pass through the credentials of the Jira user to the API, which might be challenging, but if achieved would be quite a nice feature. Yes, in a single project scenario credentials would only be visible to admins of that project and Jira admins, but if the rule is global then those credentials are visible to all project admins, which is not so good.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.