Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Powershell New-JiraIssue returning reporter required when reporter value is given

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?

 

3 answers

1 accepted

1 vote
Answer accepted

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.

I've just added the answer with some example code.  hope it helps.

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

Like Dave Nieters likes this
0 votes
john.krieg
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Sep 28, 2023

@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.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events