Hi, I'm doing some automation that aims to update an issue's field after the linked issue is closed. The field I want to update should have the value of the linked issue's project. I try to define a variable in the automation which should extract the project key, but for some reason this doesn't work.
For now I'm experimenting with getting some value and assigning it as a label to see if the value will be correct, and assign value to the variable to be {{project}}, but it doesn't work. Is this the correct way to extract the project's key or it's something else?
Hello @Gergana.Damyanova
What are the details of your Create Variable step?
What is written to the rule Audit Log for execution of the rule?
I think the problem is being caused because you are trying to set Labels in two different ways. You have specified JSON code for setting the Labels field, and you have also specified that you want to set it above that using the "Type to find value" option.
You actually don't need the JSON text at all. You can use a smart value in the "Type to find value" area.
Before addressing how to do that, though, do you want to overwrite all existing labels in the Labels fields so that only this value is there, or do you want to add this label to the field and preserve all the values that might already be there? You can use this option to specify what you want to do. By default SET is the option that is used.
Then, to add add the value from your variable, click in the field and start typing the smart value. Click on the Smart value '{{... area to have what you typed in inserted into the field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the detailed explanation @Trudy Claspill !
I don't think that is the issue, because if I changed the smart value for example with {{issue.key}}, this setup works and a label was added with the key of the issue.
Sure I can use the the GUI to select the field, but I think the JSON gives more visibility if you have to set up more fields.
My problem is that I can't extract the project key of the issue. Playing with the label is just a way to see if I can do that, otherwise the field I want to update is a custom one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, I see.
I would suggest that you use the substringBefore function to pull the project key from the issue key.
{{issue.key.substringBefore("-")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, this is such a nice workaround, haven't thought of that!
Thanks a million @Trudy Claspill , this is what I was looking for!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Trudy Claspill
I tried replying in the thread of your answer, but I constantly get some strange errors, so will continue here.
Here are the definitions of the variable and the label update action
In the Audit log I get an error the label can't contain spaces but I struggle to see where these spaces actually are.
The label 'SmartProjectBean ... can't contain spaces. (labels))
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.