You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
"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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.