We're not going to be using a custom field anymore, and we want to copy the value of this field into the Summary field.
The custom field is called Project Title; we want to make these titles the Summary of individual tickets. But the built-in scripts in Script Runner don't seem to allow themselves to be used on the Summary field. Bulk operations don't seem to be the solution, as it doesn't work on Summary either and needs to pull the value from field-to-field individually.
Is there a usable workaround?
I have an example of a SQL based solution, which I used for a migration from a multi-version custom field to "Fix Version/s". That could be readily adapted for a string-to-string copy.
Alternately, if I had to do that over, I'd probably write an ad-hoc script runner script that loops over the issues and updates the value. This has the advantage of not requiring a re-index, but it could time out depending on how many issues it has to process at the same time.
Finally, similar to the ad-hoc script, you could add a self referencing transition to the workflow, and make that a post function. It would still require some scripting, but less than the ad-hoc version as you'd be given the 'issue' to work on. From there, you could bulk transition the issues you want to perform the migration on.
The SQL, for reference, was:
delete from nodeassociation where source_node_entity='Issue' and association_type='IssueFixVersion' and source_node_id in (select issue from customfieldvalue where customfield=11122); insert into nodeassociation(source_node_id, source_node_entity, sink_node_id, sink_node_entity, association_type) select issue,'Issue',numbervalue,'Version','IssueFixVersion' from customfieldvalue where customfield=11122;
As I look at that, it's a lot more complicated, since FixVersion is a nodeassociation, and not a field of "issue". You'd probably just want to pull a list of every issue that has a customfieldvalue for the customfield in question, and craft a direct update based on the contents of the customfield. Or, directly:
update jiraissue i set summary=(select stringvalue from customfieldvalue cfv where customfield=X and cfv.issue=i.id) where i.id in (select issue from customfieldvalue where customfield=X);
To test that on one issue, add:
update jiraissue i set summary=(select stringvalue from customfieldvalue cfv where customfield=X and cfv.issue=i.id) where i.id in (select issue from customfieldvalue where customfield=X) and i.id=Y;
Where Y is the ID of a specific JIRAISSUE, as fetched by:
select id from jiraissue where issuenum=ZZZZ and project=(select id from project where pkey='KEY');
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG