Hi All,
I am using custom field (select list - cascading), for example values bellow:
Client1Environments (parent)
Env1
Env2
Env3
Env4
Client2nvironments (parent)
Env1
Env2
size of Client1Environments = 4
size of Client2Environments = 2
Problem: How can I get size of the parent? I tried to use {{Client1Environments.size}}, however it gave me nothing. If i use {{Client1Environments.child.value}} it will return me the selected value in ticket, which i can the use for further processing, however i need to get the number of how many Env is in the list.
Thank you for your help!!
Hi @l.vosahlo ,
welcome to the Atlassian Community!
I don't think it's possible. Please, what are you trying to achieve? Why do you need this information?
first off all thank you for your answer!
For example lets assume that our parent is following (it is vary according to client):
Client1Environments (parent)
Env1
Env2
Env3
Env4
myVariable = size of parent (in this case 4)
myCurrentEnvironmentId = {{#increment}}{{issue.Increment}}{{/}} (velue will be automatically increase per each iteration, in this case we know we have to run it 4times)
IF {myVariable != myCurrentEnvironmentId} (Do something else then ussual)
Basically, we are tusing JIRA for automatick deployment and this task can help us to handle our target environment:-)
I hope it is clear, if not let me know I will try to make better description.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The "size" of any cascading select list field is either 0 or 1. 0 means it is empty, 1 when it is not. A cascading select can only ever have one value in it (even though that value can be a key pair, it is still only one value). Imagine a custom field that has country/city lists in it - you can't set it to UK/London, US/San Francisco and Spain/Barcelona at the same time, it can only ever have one value.
I think what you're looking for is the *administration* data that there are X/Y options available, which is not something you would use in an automation.
I think you might be using the wrong type of field for this. Maybe it should be a multi-select?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- I definitelly agree that value can have only one value (when selecte) - just to let you know, I am able to extract this value {{IssueName.child.value}}.
However, I was hoping that i would be able to take a parent as my Array and then use some loop (like in other language - BUT I fully understand i am using JIRa for something different that should be used:-))
I am going ask you one more question. Lets say I would like to print in the log 2nd value in the Client1Environment (which is Env2) - When i use {{Client1Environment.child.Value.get(1)}} it will return nothing. is there any command i can use?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure where you're trying to do this, I wouldn't expect an automation/smart value to go into a log
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, you are right I am using Jira Automation - smart Values - I will attach some images
right side of image showing the details of my Select List (cascading) - Parent is automatically pick according to project name.
I tried those and none of this working for me:
.first()
.last()
.get(n)
I was hoping that command {{HMSEnvironment.child.get(1)}} will make a lookup in to the list and return me for example HMS Harry - Env2, but my log is empty, when rule is tested.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, you're still thinking of the cascading select as holding more than one value, which they do not. They have three possible single values:
You can get at the primary and secondary separately, even though it's still a single value. Try
{{issue.fields.Cascade.value}}
{{issue.fields.Cascade.child.value}}
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.