I'm trying to get a value from the Organizations field in JSD without the brackets.
Using ${issue.get("customfield_10002")*.name.flatten()} will get me the organization name, but puts it in brackets. How do I get rid of those?
Hi David,
Try issue.getAsString("customfield_10002"). This returns a string representation of the value of issue field. Please check the Groovy console provided by the app. It has a help system with Groovy scripts showing how to access issue fields and much more.
Regards,
Radhika
That just gives me the id of the organization and not the name.
For instance:
issue.get("customfield_10002")
Returns with this:
[CustomerOrganizationImpl{id=159, name=some company name}]
Where as:
issue.getAsString("customfield_10002")
Returns with:
159
I'm trying to access the name part of this without brackets.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh yeah. issue.get("customfield_10703")*.name.flatten() returns an array of Strings. Use the join operator to get just the name(s).
issue.get("customfield_10703")*.name.flatten().join(",")
Regards,
Radhika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One way is to use substrings; I use the following function in a script to accomplish this.
def stripBrackets(String str){
String retStr = str
if(str == null || str.length() < 2)
{
return str
}
if(retStr.substring(0,1).equals("[")){
retStr = retStr.substring(1)
}
if(retStr.substring(retStr.length()-1).equals("]")){
retStr = retStr.substring(0,retStr.length()-1)
}
return retStr
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Payne thanks for getting back to me. I'm not sure how I would use that substrings script. I'm using the JMWE plugin with groovy code.
${issue.get("customfield_10002")*.name.flatten()} gets me a value that looks exactly like this with the brackets: [some organization name].
Do you know how I would be able to use the substrings in groovy code so the result of "getting" customfield_10002 is just "some organization name" with no brackets?
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.