Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting 'Reporter field is required' error when creating Jira issue from service now via REST call

Kanhaiya Panigrahi
Contributor
February 18, 2020

I am creating jira issue from Service now via REST call which was working until yesterday

Suddenly i am getting 'Reporter' is mandatory error.

The user is having permission to modify the Reported for field and create jira issue.

When I make 'reporter' an option field, it is working. But when it is Required, It is not working.

Can anyone provide solution for this?

5 answers

1 accepted

0 votes
Answer accepted
DPKJ
Community Champion
February 18, 2020

@Kanhaiya Panigrahi  if a field is required you need to pass some value to it, otherwise API will surely give error.

Kanhaiya Panigrahi
Contributor
February 18, 2020

@DPKJ I am passing the username.

Like juanjo_gamez likes this
Kanhaiya Panigrahi
Contributor
February 18, 2020

@DPKJ 

{
"fields":{
"issuetype":{
"name":"Bug"
},
"project":{
"key":"SNOW"
},
"summary":"Issue with creating Jira tickets from ITWorx",
"description":" Issue with creating Jira tickets from ITWorx",
"priority":{
"name":"Low"
},
"customfield_10400":"INC0348345",
"customfield_10401":"https://ptc.service-now.com/incident.do?sys_id=1868e1251343cc100a083ff18144b0d9",
"reporter":{
"name":"Jira User"
}
}
}

Like Tejesh Chandra K H likes this
Kanhaiya Panigrahi
Contributor
February 18, 2020

And until yesterday it was working but suddenly it stopped.

I tried with id, name and email too for the reporter but its not working.

DPKJ
Community Champion
February 18, 2020

@Kanhaiya Panigrahi  Can you give a copy of exact error message in API response?

Ideally this should work, of field is part create screen in your Jira.

{
"fields": {
...
"reporter": {
"id": <ID_OF_REPORTER>
},
...
}

}
Kanhaiya Panigrahi
Contributor
February 18, 2020

@DPKJ The Key id is not accepted by Jira. Instead of that I tried with email & name.

But its giving me the same error.

{"errorMessages":[],"errors":{"reporter":"Reporter is required."}}

When I made reporter field optional, then Its working but even though the reporter field is not accepting the value, it remains Anonymous.

DPKJ
Community Champion
February 19, 2020

@Kanhaiya Panigrahi  and @Marcin_Kujawa 

I am not sure what is wrong in your site, after

  • Making reporter field required,
  • Adding it to appropriate screen (issue create screen for project/issue type)
  • Assigning `Project Role` permission to 'Modify Reporter'

I was able to make a rest request using CURL, and it worked perfectly fine. Here is sample of that curl request,

curl --request POST \
--url '<SITE_URL>/rest/api/3/issue' \
--user '<EMAIL>:<API_TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fields": {
"project": {
"key": "SP"
},
"summary": "Issue with reporter test #1",
"issuetype": {
"name": "Task"
},
"reporter": {
"id": "<USER_ID>"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "description",
"type": "text"
}
]
}
]
}
}
}'
Like Kanhaiya Panigrahi likes this
Kanhaiya Panigrahi
Contributor
February 19, 2020

@DPKJ Now its working for me. Thanks for the solution. 

Earlier I thought By ID it measn name before @domainName

But currently I just passed id of the user which I picked from the URL.

{
"fields":{
"issuetype":{
"name":"Bug"
},
"project":{
"key":"SNOW"
},
"summary":"Issue with creating Jira tickets from ITWorx2",
"description":" Issue with creating Jira tickets from ITWorx2",
"priority":{
"name":"Low"
},
"customfield_10400":"INC0348345",
"customfield_10401":"https://ptc.service-now.com/incident.do?sys_id=1868e1251343cc100a083ff18144b0d9",
"reporter":{
"id":"59f6fdf0883e38789b8e1e8f"
}
}
}

2 votes
Tom Boyle February 21, 2020

We've had the same issue this week ourselves. We've currently also worked around it by hardcoding an ID but defeats the point of the field.

It has been working for months up until now.

Has something changed in Jira in relation to the Reporter field?

DPKJ
Community Champion
February 23, 2020

@Tom Boyle  Yes, GDPR has started kicking in for API's. So using ID field of user is best bet at this time.

Like Tom Boyle likes this
jyparida
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!
February 27, 2021

how can we user name instead of id to set reporter field is there nay way

Like # people like this
1 vote
Francisco Mancardi
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!
May 31, 2020

Why the hell they have did this change!!!, this has broken my integration, and is IMHO a very bad option when you need to integrate different systems.

0 votes
Kim Kokholm
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!
April 30, 2020

Hi
i have similar issues though just in Powershell

Script

$parameters = @{
Project = 'INF'
#customfield_10930 = 'INF-2312'
issueType = 'Task'
Reporter ='kim.kokholm'
Summary = 'Test issue from PowerShell'
Description = "This is a sample issue created by ." }

New-JiraIssue @parameters

error

Invoke-JiraMethod :
reporter
--------
Reporter is required.
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.12.5\JiraPS.psm1:3842 char:27
+ if ($result = Invoke-JiraMethod @parameter) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
+ FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod


Brian McGrath October 8, 2021

 

has anyone figured out 'reporter is required' for PowerShell? I am having same issue. thanks!

Guillermo Robaudo
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!
February 6, 2022

Hi @Brian McGrath  it work for me
I were introduced reporter inside Fields with my customefields as you can see below and get Account ID beforehands from email address

 

$user = "email@domain.com"
$reporter = (Get-JiraConfigServer -ErrorAction Stop) + "/rest/api/3/user/search?query=" + $user
$accountId = (Invoke-JiraMethod $reporter).accountId # you need to use ID due GDPR

 

$parameters = @{
Project = "PROJECTNAME"
IssueType = "ISSUETYPE"
Summary = "Test issue from PowerShell XXX"

Fields = @{
customfield_11449 = { value = "option3" }
reporter = @{ "id" = $accountId }

}
}
New-JiraIssue @parameters

 

 

 

References

Solved: How to do user search with v3 REST API? (atlassian.com)

Custom Fields - Docs | AtlassianPS

Like TTadashii-Ching likes this
0 votes
Marcin_Kujawa February 18, 2020

I have the same problem. Reporter field has value (username), but I receive 'Repoter is required' exception.

Marcin_Kujawa February 18, 2020

I set Reporter as an optional field and it worked, but it's just workaround, not solution.

Like # people like this
Kanhaiya Panigrahi
Contributor
February 18, 2020

@Marcin_Kujawa Thanks for the solution. I have already tried this yesterday and yes it is just a workaround not a permanent solution.

If you find anything permanent solution please post it here too.

Meanwhile I am also investigating & if i get it then will post.

Like Marcin_Kujawa likes this
Kanhaiya Panigrahi
Contributor
February 19, 2020

@Marcin_Kujawa You can pass the userid, just open the user's profile in JIRA & pick it from the URL. 

{
"fields":{
"issuetype":{
"name":"Bug"
},
"project":{
"key":"SNOW"
},
"summary":"Issue with creating Jira tickets from ITWorx2",
"description":" Issue with creating Jira tickets from ITWorx2",
"priority":{
"name":"Low"
},
"customfield_10400":"INC0348345",
"customfield_10401":"https://ptc.service-now.com/incident.do?sys_id=1868e1251343cc100a083ff18144b0d9",
"reporter":{
"id":"59f6fdf0883e38789b8e1e8f"
}
}
}

Marcin_Kujawa February 19, 2020

Thank you. Maybe it works, but I'm using Atlassian.Jira (.NET nuget package). I have only 'Reporter' field, no Id subfield within it. It seems I have to wait form new version of that library.

Like Deepthi.Posimsetty likes this
Kanhaiya Panigrahi
Contributor
February 19, 2020

@Marcin_Kujawa Even I didn't find anything with fieldname 'id'

But If you are able to search the user in people section then open user's profile

then from URL you can pick the id

https://ptc-it.atlassian.net/jira/people/59f6fdf0883e38789b8e1e8f 

Ian Larner
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!
March 24, 2020

@Kanhaiya Panigrahi The problem mentioned before, and that I have, is that the Reporter / name subfield is required but Jira refuses to accept any value for 'name'.

I had to make Reporter optional to be able to create new issues.  When I retrieve the issue data, the Reporter data is null.  If I set a Reporter in Jira UI, and then retrieve the issue again, the Reporter data does not contain a 'name' sub-field.

 "created": "2020-03-24T10:00:05.000Z",
"reporter": {
"self": "https://xxx.atlassian.net/rest/api/2/user?accountId=5a964372b81cd2381486a5de",
"emailAddress": "ixxx@gmail.com",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/1f44eeb2d6cbf38e55721f57f5a72022?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIL-5.png&size=48&s=48",
"24x24": "https://secure.gravatar.com/avatar/1f44eeb2d6cbf38e55721f57f5a72022?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIL-5.png&size=24&s=24",
"16x16": "https://secure.gravatar.com/avatar/1f44eeb2d6cbf38e55721f57f5a72022?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIL-5.png&size=16&s=16",
"32x32": "https://secure.gravatar.com/avatar/1f44eeb2d6cbf38e55721f57f5a72022?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIL-5.png&size=32&s=32"
},
"displayName": "Joe Bloggs",
"active": true,
"timeZone": "Europe/London",
"accountId": "5a964372b81cd2381486a5de",
"accountType": "atlassian"
},
Kanhaiya Panigrahi
Contributor
March 24, 2020

Actually it contain 'id' as a sub field instead of name now.

I highlighted the same below. you can try with this. In the value just pass user's sys id which yo will get from the URL of user's profile.

{
"fields":{
"issuetype":{
"name":"Bug"
},
"project":{
"key":"SNOW"
},
"summary":"Issue with creating Jira tickets from ITWorx2",
"description":" Issue with creating Jira tickets from ITWorx2",
"priority":{
"name":"Low"
},
"customfield_10400":"INC0348345",
"customfield_10401":"https://ptc.service-now.com/incident.do?sys_id=1868e1251343cc100a083ff18144b0d9",
"reporter":{
"id":"59f6fdf0883e38789b8e1e8f"
}
}
}

Like Ian Larner likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events