I'm pulling JIRA data into my database using a Perl script to create csv files, which are then imported to the database. While I'm able to pull in the "affectsVersions" and "fixVersions", I'm having trouble pulling in just the displayed string for a custom field of the same type, "Version Picker". (It's custom field number "10780" below).
Here's the related snippets...
sub getSingularObjectFromString($$);
print(getVersions($issue->{affectsVersions}) . $DELIM); # gets displayed contents
print(getVersions($issue->{fixVersions}) . $DELIM); # gets displayed contents
print(getSingularObjectFromString($issue, 10780) . $DELIM); # Trying to get just the "displayed" contents
...for "affects versions" and "fixVersions" I can just pull the data by using "getVersions"...
sub getVersions {
my ($versions) = @_;
my $str;
return "" if (scalar(@$versions) == 0);
foreach my $version (@$versions) {
if ($str) {
$str .= ", " . $version->{name};
} else {
$str = $version->{name};
}
}
return $str;
}
...but since "testVersions" is a custom field (of the same type as the others), I'm trying to get just the displayed/rendered value that appears.
# Trying to get just the "displayed" contents of the "test version" custom field. Tried several variations here...
sub getSingularObjectFromString($$) {
my ($issue, $fieldID) = @_;
my $customFields = $issue->{customFieldValues};
return "" if (scalar(@$customFields) == 0);
foreach my $customField (@$customFields) {
if ($customField->{customfieldId} eq "customfield_$fieldID") {
return $customField->{values};
}
}
return "";
}
...My scripts work fine and pull a version number (such as "4.3.2.1") for both "affectsVersions" and "fixVersions", but for the custom field it seems to be pulling a number that JIRA uses as a reference to those versions, so I get something like "23591" instead of "4.3.2.1". Am I missing something? I've tried these methods and a few more...
getValueFromIssue
getExternalFieldValue
getSingularObjectFromString
getCustomFieldValue
All of these pull the "number" from the custom field, not the displayed value.
Is there a way to get the displayed Test Versions of "4.3.2.1" that is displayed when the issue is viewed in JIRA? Any insight would be helpful. Thanks!