I wrote a Jira-CLI script on Python that automate all issues commands.
The script working perfectly, until last week, the Admin of the account have made a few changes where he added Environment as choices field not optional but required.
So in my script when I create a new issue, I need to include Environment as required with other fields, but always getting an error from the server says:
{"errorMessages": [], "errors":{"environment": "Field 'environment' cannot be set. It is not on the appropriate screen, or uknown."}}
if no environment was included, I get this error:
{"errorMessages": [], "errors":{"environment": "Environment is required"}}
I've also tried 'Environment' but the same thing!.
Since our account is paid I tried on my demo account, the script with environment included working fine without any errors.
<span>def</span> <span>create</span>(<span>self</span>):
issue_dict = {
<span>'project'</span>: <span>'{'</span>key<span>': f"{self.args.projectKey}"}'</span>,
<span>'summary'</span>: <span>' '</span>.join(string <span>for</span> string <span>in</span> self.args.summary) <span>or</span> <span>''</span>,
<span>'description'</span>: <span>' '</span>.join(string <span>for</span> string <span>in</span> self.args.description),
<span>'issuetype'</span>: {<span>'name'</span>: self.args.<span>type</span>},
<span>'environment'</span>: self.args.environment,
}
<span>print</span>(<span>'Create issue:'</span>, issue_dict)
new_issue = self.auth.create_issue(fields=issue_dict)
<span>print</span>(<span>'\nIssue created successfully, issue key:'</span>, new_issue, <span>'\n'</span>)