When working in Jira, you are often dealing with messy data imported from a legacy system or other external data source in a way that is difficult to query.
Transforming this data with scripts is a powerful way to make it easier to find the required issues.
I'm a developer, and my build system is automatically importing version information into a plain text custom field in Jira.
This plain text field contains a lot of information I'd like to query on (like the release date and the version number); however, it can't easily be parsed with normal JQL.
ScriptRunner has a function that can query issues by their Fix Version's release date. Converting these plain text values into versions in the project would allow me to query them efficiently.
This script takes all the issues in an example project, parses the value in the External System Version field, creates a version in the project with the appropriate release date, and updates each issue to have the correct Fix Version.
This script assumes a version of the format "com.example.whatsit.a4e7e26c4c7ab74be8f13900add1e44.2008-09-20T19:33:18.104.22.168"
There may be multiple versions that are comma-separated, as in