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.
def create(self):
issue_dict = {
'project': '{'key': f"{self.args.projectKey}"}',
'summary': ' '.join(string for string in self.args.summary) or '',
'description': ' '.join(string for string in self.args.description),
'issuetype': {'name': self.args.type},
'environment': self.args.environment,
}
print('Create issue:', issue_dict)
new_issue = self.auth.create_issue(fields=issue_dict)
print('\nIssue created successfully, issue key:', new_issue, '\n')