AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
323 stars 131 forks source link

New-JiraIssue with issue security #352

Closed PFS-IT closed 5 years ago

PFS-IT commented 5 years ago

Description

I want to create a new JIRA issue and set the issue security

Steps To Reproduce

What I've tried so far.

$Fields = @{
    description = "Test"
    duedate = "2019-05-11"  
    security = @{ id = 11213 }
}
$Fields = @{
    description = "Test"
    duedate = "2019-05-11"  
    security = { id = 11213 }
}
$Fields = @{
    description = "Test"
    duedate = "2019-05-11"  
    security = 11213
}

All fail with the following error.

Could not find a valid ID in the security object.

grafik

My command:

New-JiraIssue -Project "BIT" -IssueType "Aufgabe" -Summary "Test Issue" -Fields $Fields -Reporter "Me"

Getting rid of the security ID works!

Expected behavior

The issue gets created and the security is set.

Screenshots

See above.

Your Environment

JiraPS: 2.10.3 PowerShell: 4 Jira Core 8.0.1

Possible Solution

lipkau commented 5 years ago

what do you get as the output for

(Get-JiraIssueCreateMetadata -Project BIT -IssueType Aufgabe | ? id -eq security).AllowedValues

?

PFS-IT commented 5 years ago

Here's the output.

grafik

lipkau commented 5 years ago

I was unable to set up my environment to reproduce this. According to the documentation, this code of yours should have worked:

$Fields = @{
    description = "Test"
    duedate = "2019-05-11"  
    security = @{ id = 11213 }
}

Please run this:

New-JiraIssue -Project "BIT" -IssueType "Aufgabe" -Summary "Test Issue" -Fields $Fields -Reporter "Me" -debug

and on the message

DEBUG: [Invoke-JiraMethod] Invoke-WebRequest with $splatParameters:

enter the suspend and inspect $body

PFS-IT commented 5 years ago

Hey everyone I found a work-around by using the default cmdlet Invoke-WebRequest. Since it seems to work as expected within your environment, I propose we close this issue. Thanks either way for your help!