I'm attempting to create a new Jira issue using the powershell code below and I keep getting the error at the bottom. I can't seam to find what I'm doing wrong. This is the Powershell I'm using.
$cred = mycredential
set-jiraconfigserver -Server "https://myserver.atlassian.net"
get-jiraissue -Issue "DEV-999" -Credential $cred
Get-JiraIssueCreateMetadata -Project DEV -IssueType Task -Credential $cred | ? {$_.Required -eq $true}
#customfield_10029 = @{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10231; value=DatabaseQueue; id=10231},
$fields = @{
'components' = (
'Century Distribution Systems, Inc.'
)
'customfield_10029' = (
id=1023
)
}
New-JiraIssue -Project "DEV" -IssueType "Task" -Summary "Test for backup automation" -Description "Test for backup automation" -Reporter "me@here.com" -Labels "Maintenance:Refactoring" -Parent "DEV-998" -Credential $cred -Fields $fields -verbose
This is the error returned:
Invoke-JiraMethod : components customfield_10029 ---------- ----------------- Specify the value for components in an array Specify a valid 'id' or 'name' for Department At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.9.0\JiraPS.psm1:3603 char:27
- if ($result = Invoke-JiraMethod @parameter) {
- CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
- FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod
I can see from the output of get-jiraissuecreatemetadata that customfield_10029 is the Department field. and I"m using one of the ids that is returned as an allowed value.
Id : customfield_10029 Required : True AllowedValues : {@{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10228; value=BIOperations; id=10228}, @{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10232; value=DatabaseRelease; id=10232}, @{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10231; value=DatabaseQueue; id=10231}, @{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10049; value=DataWarehouse; id=10049}...} Operations : set HasDefaultValue : False Name : Department Schema : @{type=option; custom=com.atlassian.jira.plugin.system.customfieldtypes:select; customId=10029} key : customfield_10029
Any help would be greatly appreciated.