Skip to content

Commit

Permalink
BugFix issue AtlassianPS#482 allowing Component ID in New-Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Liberman committed Jun 25, 2023
1 parent 6499fea commit a70ddc5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
12 changes: 12 additions & 0 deletions JiraPS/Public/New-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ function New-JiraIssue {
[PSCustomObject]
$Fields,

[Parameter( ValueFromPipelineByPropertyName )]
[AllowNull()]
[String[]]
$Components,

[Parameter()]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
Expand Down Expand Up @@ -111,6 +116,13 @@ function New-JiraIssue {
}
}

if ($Components) {
$requestBody["components"] = [System.Collections.ArrayList]@()
foreach ($item in $Components) {
$null = $requestBody["components"].Add( @{ id = "$item" } )
}
}

if ($FixVersion) {
$requestBody['fixVersions'] = [System.Collections.ArrayList]@()
foreach ($item in $FixVersion) {
Expand Down
17 changes: 16 additions & 1 deletion docs/en-US/commands/New-JiraIssue.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Creates a new issue in JIRA

```powershell
New-JiraIssue [-Project] <String> [-IssueType] <String> [-Summary] <String> [[-Priority] <Int32>]
[[-Description] <String>] [[-Reporter] <String>] [[-Labels] <String[]>] [[-Parent] <String>]
[[-Description] <String>] [[-Reporter] <String>] [[-Labels] <String[]>] [[-Components] <String[]>] [[-Parent] <String>]
[[-FixVersion] <String[]>] [[-Fields] <PSCustomObject>] [[-Credential] <PSCredential>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
Expand Down Expand Up @@ -274,6 +274,21 @@ Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Components
List of component ids which will be added to the issue.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Expand Down

0 comments on commit a70ddc5

Please sign in to comment.