I'm importing some projects from Fogbugz to Jira, and as part of the import cleanup I want to convert some of the custom fields Atlassian's importer brought over to comments on the issues. Elsewhere on Answers, I found a snippet of a groovy script to set the Description system field from a custom field; I took that snipped and I can change setDescription to setComment, and change the name of their custom field to mine, but I don't want to do this as part of a workflow, I need to do this post-import. So for instance, for all projects and customfield XYZ is not empty, I want to copy customfield XYZ to comments. After the script runs (and updates say, 5000 issues) I intend on deleting the custom fields, then doing the next import of 50 projects.
Here's the snippet I have so far:
IssueInputParametersImpl inputParameters = new IssueInputParametersImpl();
inputParameters.setComment("Custom Field XYZ");
inputParameters.addCustomFieldValue(sourceCustomField, "");
validateResults = issueService.validateUpdate(user, issue.getId(), inputParameters);
if (validateResults.isValid()) {
issueService.update(user, validateResults);
}
How would I wrap that in a query and then iteratively go through the results and do that script snippet?
Or, am I going about this all wrong? Any other suggestions?
-Kelly