I am using JiraPs in Powershell to attempt to create a new Jira Issue When I run the code below I receive an error saying that the reporter is required. However I am providing a reporter as queried. I have also attempted giving the accountid my admin provided to me in the format XXXXX:XXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
This results in the same error message.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$User = "myuser"
$PWord = ConvertTo-SecureString -String "myAPIID" -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
$reporter = (Get-JiraConfigServer -Server "myserver" -ErrorAction Stop) + "/rest/api/3/user/search?query=" + $user
#$accountId = (Invoke-JiraMethod $reporter).accountId
cls
set-jiraconfigserver -Server "myserver"
$fields = @{
Components = @(
@{value = "company"}
)
customfield_10029 = @{value='DatabaseQueue'}
}
New-JiraIssue -Project "DEV" -IssueType "Sub-Task" -Reporter $accountId -Summary "Test for backup automation" -Description "Test for backup automation" -Labels "Maintenance:Refactoring" -Parent "DEV-251" -Credential $cred -Fields $fields -Debug:$True
How do I retrieve and pass a valid reporter?
I worked through a ticket with the folks at jira to get the answer. The reporter has to be passed through the fields section using the reporterid. Code should look like this.
$fields = @{
Components = @(@{name = 'Century' })
customfield_10029 = @{id = '10231' }
reporter = @{id = "99999:999aa9a9-9999-99a9-99aa-aaa999999999" }
}
New-JiraIssue -Project DEV -IssueType Task -Summary $BriefDesc -Description $FullDesc -Fields $fields -Credential $cred
I am experiencing the same issue and using version 2.14.6 of the JiraPS module.
Invoke-JiraMethod :
reporter
--------
Reporter is required.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've just added the answer with some example code. hope it helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Christopher can confirm that indeed that solution works for myself as well.... Whoever maintains the PowerShell module should ideally work on doing an update to it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Christopher , I get the same error but the above fix does not work.
I am using the JiraPS Module in Powershell. Pseudo Code below:
Get credentials
New-JiraSession
Populate required fields
$field = @{
Components = @(@{name = 'Team' })
customfield_10450 = @{id = '557058:f7' }
customfield_10333 = @{name = 'IT xxx' }
customfield_10361 = @{name = 'REQUESTS' }
reporter = @{id = '557058:f7' }
}
$params = @{
Project = $project
IssueType = $issueType
Summary = $summary
Description = $description
Labels = $labels
Fields = $field
Credential = $credential
errorAction = "stop"
}
if ($field) {
$params.Fields = $field
}
#
try {
Write-Output "Issue can be created:`n$_"
New-JiraIssue @params
Write-Output "Issue was created:`n$_"
} catch {
Write-Output "Issue cannot be created:`n$_"
}
I get the following Error:
PS>TerminatingError(New-JiraIssue): "Jira's metadata for project [ITDBABI] and issue type [Task] specifies that a field is required that was not provided (name=[Reporter], id=[reporter]). Use Get-JiraIssueCreateMetadata for more information."
Issue cannot be created:
Jira's metadata for project [ITDBABI] and issue type [Task] specifies that a field is required that was not provided (name=[Reporter], id=[reporter]). Use Get-JiraIssueCreateMetadata for more information.
Any Help would be greatly appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.