Forums

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

Error on Environment field set

deepak kalsi July 4, 2019

I am getting an error for "environment" field  while submitting the request with following JSON. Environment is not a custom field and id in the api is also "environment'. Anybody can tell me what is wrong here:

{
    "fields": {
       "project":
       {
          "key": "projectkey"
       },
       "summary": "[entry.summary.escapeJSON]",
       "description": "[entry.description.escapeJSON]",
       "environment": "[entry.environment.escapeJSON]",
       "issuetype": {
          "name": "Incident"
       }
   }
}


error message:
  • com.atlassian.sal.api.net.ResponseException: Error communicating with Jira, {"errorMessages":[],"errors":{"environment":"Field 'environment' cannot be set. It is not on the appropriate screen, or unknown."}} Used JSON: '{ "fields": { "project": { "key": "projectkey" }, "summary": "gf", "description": "trt", "environment": "yryr", "issuetype": { "name": "Incident" } } }' Request to url = url

 

1 answer

0 votes
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 5, 2019

Hi Deepak,

As the Error is noting "It is not on the appropriate screen, or unknown" I would recomend verifying the the Field is on the create issue screen used by your workflow as the first point.

Take a look at http://<base_jira_url>/plugins/servlet/project-config/<projectkey>/screens to see what your create screen is for the project / issue type and then look at the screen verify the field is present.

Let me know if this is the issue.

Regards,
Earl

deepak kalsi July 9, 2019

@Earl McCutcheon  Thank you for reply.

Yes, the Environment field is present for the Incident(issue type) create issue screen.

deepak kalsi July 9, 2019

The error is still there.

Like Earl McCutcheon likes this
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2019

Hi Deepak,

Thanks for the confirmation, and since it's on the correct screen this means we gotta track down the "Unknown" portion of the error.

Generally when this error occurs and is not related to the screen it's going to be either a permission conflict or a syntax related error in the call.

First and this is a quick check, verify the project level permissions permissions allow the user you are submitting the request as to complete the action from the UI, exe edit the issue and update the field.

Then it could be an issue with the user/token formatting used to submit the call, check out this article and verify the settings on the authorization credential

Are you using a Application to pass the call like PostMan or are you doing a direct curl call to the endpoint, either way can you send me the full syntax of the call or a screenshot of the application settings you are using making sure to obfuscate the sensitive details like your base URL, auth token and username, while also doing a GET on the same endpoint to verify that results of the GET have a matching syntax to the POST and wether the GET is successful or not.

EXE POST to /rest/api/2/issue:

curl -D- -u EMAIL:API-TOKEN -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "fields": { "project": { "key": "projectkey" }, "summary": "gf", "description": "trt", "environment": "yryr", "issuetype": { "name": "Incident" } } }' -X POST http://INSTANCE/rest/api/2/issue

Regards,
Earl 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events