"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
Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!
Start here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.