Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

User Group in a Custom Field

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 31, 2018

We would like to see on the ticket what groups the report of a ticket belongs to. What would be the best approach?

Tried looking at API but it doens't look available. 

2 answers

1 accepted

1 vote
Answer accepted
Alexey Matveev
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 31, 2018

Hello,

You can use the Power Custom Fields add-on. It is a free add-on.

You can create a field with the following script:

return join(userGroups(reporter), ",");
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.
August 1, 2018

Thanks! Although, free add-ons usually become paid add-ons or is discontinued. We have Script Runner.

But if you know how we can get that from API that would be awesome!

Alexey Matveev
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.
August 1, 2018

It would be like this:

import com.atlassian.jira.component.ComponentAccessor

return ComponentAccessor.getGroupManager().getGroupsForUser(issue.getReporter())
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.
August 7, 2018

Thanks!

Alexey Matveev
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.
August 7, 2018

You are welcome!

hbhardwaj3
Contributor
February 20, 2019

I have tried this, but didnt get the result. I am getting something like::

[com.atlassian.crowd.embedded.impl.ImmutableGroup@5ab0a9b9, com.atlassian.crowd.embedded.impl.ImmutableGroup@aa6f0adf, com.atlassian.crowd.embedded.impl.ImmutableGroup@1845f18a, com.atlassian.crowd.embedded.impl.ImmutableGroup@86a, com.atlassian.crowd.embedded.impl.ImmutableGroup@7403ff3, com.atlassian.crowd.embedded.impl.ImmutableGroup@e239b761, com.atlassian.crowd.embedded.impl.ImmutableGroup@42b66b45, com.atlassian.crowd.embedded.impl.ImmutableGroup@9099bd68, com.atlassian.crowd.embedded.impl.ImmutableGroup@852dcdc5, com.atlassian.crowd.embedded.impl.ImmutableGroup@976d6f29, com.atlassian.crowd.embedded.impl.ImmutableGroup@95a62d82, com.atlassian.crowd.embedded.impl.ImmutableGroup@ca5d9308, com.atlassian.crowd.embedded.impl.ImmutableGroup@58e3f5fa, com.atlassian.crowd.embedded.impl.ImmutableGroup@2d90ea2a]

0 votes
Bastian Stehmann
Community Champion
July 31, 2018

Hi @Marc Jason Mutuc,

if you have Scriptrunner, maybe you can use a scripted field, that gets the information from the reporter and displays it.

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.
August 1, 2018

Yes. I'm just having trouble getting it. Is it 

userUtil.getGroupNamesForUser

Bastian Stehmann
Community Champion
August 1, 2018

I did that once, but do not have the script at hand. It was something like Alexey posted, so please just try his solution.

Suggest an answer

Log in or Sign up to answer