Forums

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

Use Scriptrunner to add multiple groups to a single user

David Lee
May 16, 2022

I am new to Scriptrunner and I want to speed up the onboarding process by building some "persona" style scripts. For example,

User - "Project manager" requires "jira-user", "jira-software", "customer-share" groups

(I usually have 20-30 groups to add)

Is there a script I could use to run to add this in?

Thanks

David

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Mike Quentel
Contributor
February 5, 2024
// can run this example of getting the time in ScriptRunner console
// https://${MY_SERVER}/jira/plugins/servlet/scriptrunner/admin/console

import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
IssueManager issueManager = ComponentAccessor.issueManager
Issue issue = issueManager.getIssueObject("TEST-9999")
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def result = changeHistoryManager.getChangeItemsForField(issue, "status").find {
it.toString == "Done"
}?.getCreated().getTime()

log.debug(result)
0 votes
April
Contributor
June 19, 2018

I'd like to figure this one out to. The problem is this:

I can make a scripted field to capture the date the transition was executed, and I'm all set for new issues.

However, my user just asked to get this populated on existing issues, which means poking through history.

I assume I need to build an array here and look for the last instance, but perhaps there is some more elegant way to do this.

Thanks

TAGS
AUG Leaders

Atlassian Community Events