Working with a Group Picker (multiple groups), how do I get the group name?

Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

I've tried using Calulated Text and just get the value of this Group Field. However, what I'm getting is not the Group Field displayed value but the following :

[com.atlassian.crowd.embedded.impl.ImmutableGroup@d9c30e6a]

I also tried copying it over to a Text Field but got the following

com.atlassian.crowd.embedded.impl.ImmutableGroup@d9c30e6a

Is there a way to get the group name and be able to use substring function on it? For usernames, I use displayName and get the Full Name of the user.

It's definitely different for groups as using the same does not yield the desired result.

2 answers

1 accepted

0 votes
Answer accepted
David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

You can use the getName() method on the field value:

issue.get("customfield_12345").getName()

Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

It did not work. :(

I tried it on both the Group Field and the Text Field it was copied to.

David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

It can only work on the Group field (customfield_12345 in my example). What kind of field is your group field exactly?

If it's a multi-valued field, you can probably use (untested):

if (issue.get("customfield_12345")==null || issue.get("customfield_12345").size() == 0)
   return null;
return issue.get("customfield_12345").iterator().next().getName()

If it doesn't work, look at atlassian-jira.log for syntax errors.

Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

Alright! Thank you so much for the help David! Really appreciate it. :)

I'm trying this now but it's not giving me the EquivalentID

if (issue.get("customfield_12345")==null || issue.get("customfield_12345").size() == 0)
return null;
if "ABCDEF".equals(issue.get("customfield_12345").iterator().next().getName().substring(7,13))
return EquivalentID;
return Unavailable;

Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

IT WORKS!!! Thank you! Is there a reference that I could look into in order to improve the knowledge you are imparting me? I'm not really a Jave Programmer. I've experience on the very old AS400 / RPG Language.

David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2014

Unfortunately, this requires some knowledge of the internal data model of JIRA, which comes from accessing the JIRA source code which you get with any commercial license.

Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2014

Figured it out. I just need to add "" to the strings. :)

0 votes
Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 29, 2018

Just used this solution again. It is still working.

Suggest an answer

Log in or Sign up to answer