I use the Get-JiraIssueCreateMetadata cmdlet today to get a list of fields for the issue type and then I use that schema to convert customfield names to friendly names. This works well except for fields that are not in the create screens.
Description
I tried to use the Get-JiraIssueEditMetadata cmdlet to fetch the schema but it doesn't support the -Project, meaning I would have to fetch once per issue.
#
## Currently use "Create" but would prefer to use "Edit"
#
$fieldschema = Get-JiraIssueCreateMetadata -Project $JiraProjectKey -IssueType 'Task'
#
## Get a map of custom fields for translation/rename
#
$customFields = $fieldschema | ?{$_.Id -like "customfield_*"}
$personFields = $fieldschema | ?{$_.Schema.Type -eq "user"}
$issues = Get-JiraIssue -Query "project = '$JiraProjectKey' AND created >= -$($LookbackDays)d"
foreach($issue in $issues)
{
# Fix up custom fields
foreach($cf in $customFields)
{
if($issueField = $issue.psobject.Properties[$cf.Id])
{
$issue | Add-Member -NotePropertyName $cf.Name -NotePropertyValue $issueField.Value
$issue.PSObject.Properties.Remove($cf.Id)
}
else
{ # stub out the field with a null for consistent CSV exporting
$issue | Add-Member -NotePropertyName $cf.Name -NotePropertyValue $null
}
}
# Promote the display name for user fields
foreach($pf in $personfields)
{
if($f = $issue.PSobject.Properties[$($pf.Name)])
{
$f.Value = $f.Value.DisplayName
}
}
# for all others, de-reference anything that has a "value" field
foreach($f in $issue.PSObject.Properties)
{
if($f.Value.Value -ne $null)
{
$f.Value = $f.Value.Value
}
}
Write-Output $issue
}
Could you add the -Project to Get-JiraIssueEditMetadata?
Context
Description
Could you add the -Project to
Get-JiraIssueEditMetadata
?