Commit 89e61fa 1 parent 53476e7 commit 89e61fa Copy full SHA for 89e61fa
File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,17 @@ function Get-JiraIssueCreateMetadata {
29
29
Write-DebugMessage " [$ ( $MyInvocation.MyCommand.Name ) ] PSBoundParameters: $ ( $PSBoundParameters | Out-String ) "
30
30
31
31
$projectObj = Get-JiraProject - Project $Project - Credential $Credential - ErrorAction Stop
32
- $issueTypeObj = Get-JiraIssueType - IssueType $IssueType - Credential $Credential - ErrorAction Stop
32
+ $issueTypeObj = $projectObj.IssueTypes | Where-Object - FilterScript {$_.Id -eq $IssueType -or $_.Name -eq $IssueType }
33
+
34
+ if ($null -eq $issueTypeObj.Id )
35
+ {
36
+ $errorMessage = @ {
37
+ Category = " InvalidResult"
38
+ CategoryActivity = " Validating parameters"
39
+ Message = " No issue types were found in the project [$Project ] for the given issue type [$IssueType ]. Use Get-JiraIssueType for more details."
40
+ }
41
+ Write-Error @errorMessage
42
+ }
33
43
34
44
$parameter = @ {
35
45
URI = $resourceURi -f $projectObj.Id , $issueTypeObj.Id
Original file line number Diff line number Diff line change @@ -66,7 +66,17 @@ function New-JiraIssue {
66
66
Write-DebugMessage " [$ ( $MyInvocation.MyCommand.Name ) ] PSBoundParameters: $ ( $PSBoundParameters | Out-String ) "
67
67
68
68
$ProjectObj = Get-JiraProject - Project $Project - Credential $Credential - ErrorAction Stop - Debug:$false
69
- $IssueTypeObj = Get-JiraIssueType - IssueType $IssueType - Credential $Credential - ErrorAction Stop - Debug:$false
69
+ $issueTypeObj = $projectObj.IssueTypes | Where-Object - FilterScript {$_.Id -eq $IssueType -or $_.Name -eq $IssueType }
70
+
71
+ if ($null -eq $issueTypeObj.Id )
72
+ {
73
+ $errorMessage = @ {
74
+ Category = " InvalidResult"
75
+ CategoryActivity = " Validating parameters"
76
+ Message = " No issue types were found in the project [$Project ] for the given issue type [$IssueType ]. Use Get-JiraIssueType for more details."
77
+ }
78
+ Write-Error @errorMessage
79
+ }
70
80
71
81
$requestBody = @ {
72
82
" project" = @ {" id" = $ProjectObj.Id }
@@ -85,6 +95,10 @@ function New-JiraIssue {
85
95
if ($PSCmdlet.MyInvocation.BoundParameters.ContainsKey (" Reporter" )) {
86
96
$requestBody [" reporter" ] = @ {" name" = " $Reporter " }
87
97
}
98
+ elseif ($ProjectObj.Style -eq " next-gen" ){
99
+ Write-DebugMessage " [$ ( $MyInvocation.MyCommand.Name ) ] Adding reporter as next-gen projects must have reporter set."
100
+ $requestBody [" reporter" ] = @ {" name" = " $ ( (Get-JiraUser - UserName ((Get-JiraSession ).UserName)).Name) " }
101
+ }
88
102
89
103
if ($Parent ) {
90
104
$requestBody [" parent" ] = @ {" key" = $Parent }
You can’t perform that action at this time.
0 commit comments