Forums

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

Scriptrunner Merge Two User Lists and Populate on Issue

Dorian Workman
Contributor
April 3, 2020

Hi

I'm a complete coding and scriptrunner newbie so please forgive what is probably a basic question.

I am trying to create a Scriptrunner script that will populate an issue custom field with a distinct list of users pulled from two sources: a Jira user group and another multi-user custom field on the issue.

I have at least figured out how to pull in the user(s) in the user group and the user(s) in the issue custom field, but I can't figure out how to create a single consolidated list of unique users from those two sets, and then populate that list into another custom field.  I've gotten this far, can anyone help me with the rest please?

Thanks!

 

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()
def nc = groupManager.getUsersInGroup("new-calc-test")
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_12705")
def cFieldValue = issue.getCustomFieldValue(cField)

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Andrea Pannitti
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 Champions.
July 25, 2022

Hi @Richelle Nixon,

I think you just have use linkedIssuesOfRecursive JQL function, setting your conditions in subquery of this function.
This is the reference page for this JQL.

Richelle Nixon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 26, 2022

The linkedIssuesOfRecursive function does not meet my needs. As mentioned, it only looks at the jira cases listed under the Linked Issues. "Parent Issue" is a different field. There used to be functions like portfolioChildrenOf to trace the hierarchy through the "Parent Issue" field, but they have been discontinued.

TAGS
AUG Leaders

Atlassian Community Events