Closed adrianobr closed 8 years ago
Issue issue=IssueFactory
.createWithSubject(ticketSubject);
CustomField customField=CustomFieldFactory.create(customFieldId);
customField.setValue(value);
issue.addCustomField(customField);
redmineManager.getIssueManager().createIssue(issue);
thank you!
I need now retrieve the description of the possible values for a custom field, idea?
I am out of office now, tomorrow I will check my source code and see if I already have an example
ok, thanks for your help!!
news?
Sorry I didn't found any example in my source code but here is a little reflection that came to my mind, normally it will work :
Issue issue=redmineManager.getIssueManager().getIssueById(issueId, Include.journals);
CustomField cf=issue.getCustomFieldById(customFieldId);
String description=cf.getName();
String value=cf.getValue();
yes, now I can capture the name and value. My problem is when this custom field is an enumerator. Example: My field can take the following values: {[value: 1 text: "One"], [value: 2 text: "Two"], [value: 3 text: "Three"]}
If I capture the custom field id will have: ID: X Description: My Field Value: 2 (for example) Values: null ???
I am integrating with another system where the only key I get is the description "One", "Two", "Three" and register a task I set the custom field by Value (1, 2, 3). Ie must have the list of Values (with description) to know what value to assign to the custom field.
Can you help me?
Have you tried List<String> values=cf.getValues();
?
I understand, the data values are IDs
<select>
<option value = "1"> One </ option>
<option value = "2"> Two </ option>
<option value = "3"> Three </ option>
</select>
I need the description and not the values. Do you understand?
Sorry no idea about that, but if you have access to db you can select them from the bitnami_redmine.custom_fields
table.
Or maybe you should hardcode it with a standard if else
String desc="";
if (cf.getValue()==1)
desc="One";
ok, I try to access directly to the database. thank you!
you are welcome
sample:
RedmineManager mgr = RedmineManagerFactory.createWithUserAuth(redmineURI, login, password);
CustomFieldManager customFieldManager = mgr.getCustomFieldManager();
List<CustomFieldDefinition> list = customFieldManager.getCustomFieldDefinitions();
I added this to CustomFieldManager javadoc
how to create and add custom fields to redmine api? example code?