"customfield_123": {
"required": true,
"schema": {
"type": "option",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
"customId": 123
},
"name": "Field_123",
"key": "customfield_123",
"hasDefaultValue": false,
"operations": [
"set"
],
"allowedValues": [
{
"self": "https://xyz.atlassian.net/rest/api/2/customFieldOption/1",
"value": "abc",
"id": "1"
},
{
"self": "https://xyz.atlassian.net/rest/api/2/customFieldOption/2",
"value": "pqr",
"id": "2"
}
]
}
I want to fill above field while creating issue using REST API in spring.
IssueInputBuilder issueBuilder = new IssueInputBuilder(projectKey, issueType, issueSummary);
issueBuilder.setFieldValue("customfield_123", 1L);
issueBuilder.setFieldValue("customfield_123", "1");
issueBuilder.setFieldValue("customfield_123", "abc");
I have used above variations and all giving the same error below.
Caused by: RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={customfield_123=Specify a valid 'id' or 'name' for Field_123}, errorMessages=[]}]}
What should be approach here?
Hi @Anshul Mittal -- Welcome to the Atlassian Community!
First thing, you might also want to look in the developer community for questions like this one: https://community.developer.atlassian.com/
Back to your question...and I have not tried this to verify...
That second parameter to setFieldValue() can be a ComplexIssueInputFieldValue, and so you would need to compose it as needed. Your custom field appears to be a single select field and so you would need to provide either the id or name attribute for selection.
Kind regards,
Bill
Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.
Register here ⬇️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.