I would like to do the following.
1. Extract the issue value which will return a string like "Topic - Title[ID]"
2. Only use the ID from the string above in my query to the data returned by my elements connect JSON using something like. $.data[?(@.attributes.name == "ID")]
I have tried to write the code using split below but it isnt working.
#set($input = $issue.get("Topic"))
#set($part1 = $input.split("[")[1])
#set($part2 = $part1.split"[")[0]
Part1 is $part1 -> This is always empty.
Is there a way to split a string in the elements connect configuration? Is there a way to use regex?
Hello @Deepak Elias
I am part of the Elements support team.
The toString().replaceAll() function can be used as a regex. Please take a look at the following documentation: Elements Connect - Velocity - String
What is the type of the parent field (the one that returns "Topic - Title[ID]"). Is it another Connect field, a basic Text customfield, or something else?
Kind regards,
Simon.
Hi @Simon Laffont thanks for the quick response. The parent field is part of the issue returned by another Connect configuration (so I guess its a Connect field). Still learning JSD.
To confirm I can do the following.
#set($regex1 = "/(.+\[)")
Regex1 is $regex1
#set($input = $issue.get("Cloud Application")) --> This will return the "Topic - Title[ID]"
Input is $input
#set($part1 = $input.toString().replaceAll($regex1, ""))
Part1 is $part1
#set($regex2 = "/(\])")
#set($part2 = $part1.replaceAll($regex2, ""))
Part2 is $part2
$.data[?(@.attributes.name == $part2)] --> I just want to the ID part of $input
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Before going any further, we need to know the exact type of the parent field.
If it's a Connect field, you should be able to find it in the Fields tab, via the Elements Connect administration menu:
If the parent field is a Connect field, can you please:
If you wish to continue this conversation in private, feel free to raise a ticket on our support instance, by clicking here.
Kind regards,
Simon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Simon Laffont , thanks for the help.
Happy to keep the conversation going here so others can benefit from anything we find, unless you think otherwise.
It is a Connect field and its Live. Its a single-value text field.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alright.
In the case of a Live field, only the key is stored in Jira and the displayed value remains in the external datasource (the displayed value corresponds to the field template). This means that only the key can be passed from one field to another.
Please see "What is a good key in an Elements Connect field?".
So what you are trying to do (retrieve the displayed value from a Live field) is not possible. When you do that, you get the key. Do you get my point?
Now my question is: what key is currently set in the Parent field? If the ID attribute is the parent field key, then you can get it directly without formatting it.
Kind regards,
Simon.
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.