Hi everyone,
The CONTEXT is the following one :
There is an epic which contains several issues.
Each issues are named specifically like for example "ABC-12" or "HD-7238".
The issues "ABC-12" and "HD-7238" are related to the epic W.
There is always a dash "-" in the issue name.
GOAL:
Inside an automation I would like to write a function that for each issue assigns to the related epic, a label with the value of the X characters before the dash in the issue name.
So for the issue "ABC-12", the epic W will be assigned the label "ABC" and for the issue "HD-7238" the epic W will be assigned the label "HD".
Would it be possible to help me build the JSON program to complete this JIRA automation or would it be possible to point me to the relevant JSON functions to create such a program?
Below is an image of the structure of the automation I am thinking of using.
Many thanks in advance for your help and your time that would be very valuable!
Hi @Romain Lavie
Developer from Automation here.
"Each issues are named specifically like for example "ABC-12" or "HD-7238"."
In terms of adding that label from the issue smart value you were close, but the name of an issue is considered the summary and not the key. So using the issue name would be more like {{triggerIssue.summary.split("-").first}}, you would also use triggerIssue since you are trying to edit the epic using a branch. I would also consider adding some conditions to ensure the issue has - in the first place as well, but it's not necessary. In terms of adding a label, it's easiest to use the "Edit issue" action, select "..." and on the append section you can type in smart values like the above.
I've attached below and example that should do the job, the other thing you'll need to think about is the triggering action. In this example I used on issue created, you could also possibly use issue updated, or field value trigger depending on what triggering action you want the rule to run with. As a tip when trying out a rule, manual triggers can be useful.
Hope this help, if you require further help with your rule you can get in touch with support: https://support.atlassian.com/
Cheers.
Hi @Yvan Martin thank you so much for your help ! Very helpful to deep dive into JIRA and understand how automations work !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Context is key for automation rules...
When you want to reference the triggering issue(s) inside of a branch, please try this one:
{{triggerIssue}}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the code that I wrote, but I couldn't figured out why it didn't work :
{
"fields": {
"labels": [{
"add": {{issue.key.split("-").first}}
}],
}
}
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.