Creating an Issue using the Java API with IssueInputParameters

Eimear Larkin March 8, 2018

Hi,

We have an existing own-developed plugin that creates an issue from another issue. This uses issueManager.createIssueObject() and has worked fine up to recently where in some workflows it has just randomly stopped working, even though it is working elsewhere.

Anyway, this made me look at refactoring the plugin to using the IssueService with IssueInputParameters. I have managed to get an issue created and all the system fields copy over fine however using issueInputParams.addCustomFieldValue(String id, String value) isn't copying over the custom field values. It's not giving any errors in the logs and the issue is still created but the customfield values are not being stored on the issue

Code sample as follows, I just simplified it right down to try get it working but to no avail!:

CustomField customField = customFieldManager.getCustomFieldObjectByName("Business Support Estimated");
issueInputParams.addCustomFieldValue(customField.getId(), "3");

 Anyone experience the same problem?

 

Thanks,

Eimear

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2018

The value, which you have to provide for the addCustomFieldValue, depends on the type of the custom field. Kindly read my article, on what values you should provide for each custom field (number 3 in my article). Also the field must be on the create screen. And that is the difference with the method, which you used before.

https://community.atlassian.com/t5/Agile-articles/Three-ways-to-update-an-issue-in-Jira-Java-Api/ba-p/736585

Eimear Larkin March 9, 2018

Thanks Alexey, the field not being on the create screen was the issue! :) And your document will come in very handy thanks! :)

Suggest an answer

Log in or Sign up to answer