Hi, We currently have on-premise JIRA application. Currently the user id's are managed within the application. We have a need to enable our internal email id authentication. Same users, but instead of the user id's created inside the application, they will be using company email id's to login.
We are exploring options on how to map the issues from old id to new id, so that we can continue to have the issues properly aligned.
What options do we have please?
If we can export all issues (hoping exported data will have Issues, associated projects, and associated user id's), and update the user id's in the exported sheet and import it back? Is there any such option?
i have used SQL in the past to do this.
Not recommended if you are not familiar with the Jira dB.
I have performed recent migrations with Scriptrunner. If I can find the script I’ll post it here later.
Tom
This is groovy ScriptRunner approach
import com.atlassian.jira.issue.comments.MutableComment
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.user.ApplicationUser
import org.apache.log4j.Logger
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.bc.issue.IssueService.IssueValidationResult
import com.atlassian.jira.bc.issue.IssueService.UpdateValidationResult
import com.atlassian.jira.bc.issue.IssueService.IssueResult
def logit = Logger.getLogger("com.cheil.eu.logging")
// **********************************************
// user replacements
// **********************************************
// key : value
def users = [
"blah@cheileu.com":"blah@cheil.com",
"balh1@cheileu.com":"blah1@cheil.com",
"blah2@cheileu.com":"blah2@cheil.com"
]
String oldUser
String newUser
String assigneeclause1 = 'assignee in ( "'
String reporterclause1 = 'reporter in ( "'
String clause2 = '")'
// set true to add key (lefthand value), set false to add value (righthand value)
boolean adduser = true
def jqlSearch
List<Issue> issues = null
SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
UserManager userMgr = ComponentAccessor.getUserManager()
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueManager issueManager = ComponentAccessor.getIssueManager()
IssueService issueService = ComponentAccessor.issueService
def searchResult
users.each() {
if (adduser) {
oldUser = it.key
newUser = it.value
} else {
oldUser = it.value
newUser = it.key
}
// ASSIGNEE
jqlSearch = assigneeclause1 + oldUser + clause2
logit.info( "" + jqlSearch)
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
StringBuffer sBuf1 = new StringBuffer()
searchResult.getResults().each { issue ->
sBuf1.append(issue.getKey() + ", ")
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.setSkipScreenCheck(true);
issueInputParameters.setAssigneeId(newUser)
UpdateValidationResult updateValidationResult = issueService.validateUpdate(user, issue.id, issueInputParameters);
if (updateValidationResult.isValid())
{
IssueResult updateResult = issueService.update(user, updateValidationResult);
if (!updateResult.isValid())
{
sBuf1.append("Y, ")
}
}
}
logit.info(sBuf1.toString())
} else {
logit.error("Invalid JQL: " + jqlSearch);
}
// REPORTER
jqlSearch = reporterclause1 + oldUser + clause2
logit.info( "" + jqlSearch)
SearchService.ParseResult parseResult2 = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
searchResult = searchService.search(user, parseResult2.getQuery(), PagerFilter.getUnlimitedFilter())
//logit.info(searchResult.getResults().size())
StringBuffer sBuf2 = new StringBuffer()
searchResult.getResults().each { issue ->
sBuf2.append(issue.getKey() + ", ")
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.setSkipScreenCheck(true);
issueInputParameters.setReporterId(newUser)
UpdateValidationResult updateValidationResult = issueService.validateUpdate(user, issue.id, issueInputParameters);
if (updateValidationResult.isValid())
{
IssueResult updateResult = issueService.update(user, updateValidationResult);
if (!updateResult.isValid())
{
sBuf2.append("Y, ")
}
}
}
logit.info(sBuf2.toString())
} else {
log.error("Invalid JQL: " + jqlSearch);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ismail Gundlur
Have you tried doing a jql with the current assignee id and then a bulk edit ?
e.g.
jql -> assignee = ismail
that shows 100 issues.
Then on Tools -> Bulk Change->Select issues that you want ->Edit Issues->Change Assignee-> ismail2
Let me know if that helps you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.