In order to track issues added to the sprint after sprint start, I am trying to set up an automation as follows:
{
"update": {
"labels": [{
"add": {{issue.sprint.last.name.asJsonStringArray.replace(" ","-")}}
}]
}
}
When the sprint is started, issues in that sprint are edited: they receive a label that is copied from the name of the current sprint.
Jira throws an error about the JSON. I have to use this because the 'Choose fields to set' does not allow me to add a new label on top of the existing ones.
On the screenshot above, it says 'The JSON is valid' but the audit log says 'Error while parsing additional fields. Not valid JSON.'
When I type:
{
"update": {
"labels": [{
"add": {{issue.sprint.last.name.asJsonStringArray.replace(" ","-")}}
}]
}
}
it throws the error "The label 'TEST Sprint 10' can't contain spaces. (labels))" so I suspect it's the attempt to remove spaces that doesn't work.
Any help to make this work would be greatly appreciated.
Rather than using the JSON to repeatedly extract the value, I recommend using a variable to capture it one time (from the trigger value) and then using the Edit Issue and Labels field ... ADDREMOVE option to make the update.
For example:
Kind regards,
Bill
Hi @Bill Sheboy , thank you that worked perfectly. I wasn't sure how variables worked but that solved the issue.
For anyone else reading, it did not remove prior labels and it only added the current sprint as label, even if the issue had been in several sprints before.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
This is exactly what I need to do but I am not sure if I am doing it on the right way since it is not working to me.
Can someone check what am I doing wrong?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
This is exactly what I need to do but I am not sure if I am doing it on the right way since it is not working to me.
Can someone check what am I doing wrong?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In your rule's Edit Issue action, the smart value is in the field for Labels to Remove. Please clear that and put it in the Labels to Add field. And then re-test.
If that does not help...please post images of:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response @Bill Sheboy
It is not working with the changes you suggested. However, I am not sure if this is exactly what I need since we have 3 sprints: 1."Para refinar", 2."Para refinar" and the current sprint.
Only the current sprint has dates and I need to add labels only to the issues added to the current sprint after the sprint started.
I have tried many automations with conditions and also the solution you posted here, but nothing is working and I really don't know what else I can do.
Your help with this problem would be more than appreciated.
:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please provide the images I noted above as something is incorrect in the implementation of your rule and seeing the images will provide context:
When the trigger is Sprint Started, the Created Variable I described could only contain the current (active) sprint's name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your response Bill,
I have been able to create the automation to add a label when an issue is added after the sprint started only for the active sprint so that is not added in previous stages. This automation is also removing the label when the issue is taken back from the active sprint to previous stages.
The audit logs are all successfull:
The only problem I have now is that this label is not added when the issue when trough different active sprints like this:
¿Any idea on how can I solve this last issue?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for those images. I see two problems with the rule you show:
First, within an issue the sprint field is a list of values. And the condition inside of the branch is checking {{issue.sprint.state}} That could produce a list of values, such as:
closed, closed
or
closed, closed, active
Perhaps try testing this way with the smart values condition to detect when the issue is not in the active sprint:
This could also be tested more easily with a JQL condition on the issue:
(sprint NOT IN openSprints() OR sprint IS EMPTY)
Next, when a rule edits an issue in the cloud, it does not automatically refresh the data the rule holds. And thus your update of the Labels in the branch is not visible to the rest of the rule, and so could fail the later condition.
When you want the updates to be visible, add the Re-fetch Issue action after the first edit action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can add additional labels by using the smart value {{issue.labels}} and the label that you want to add. See the following. This works in my testing.
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.