Within a JIRA listener plugin, from JIRA project A, after an issue update based of a trigger, I update an issue in JIRA project B. Code as follows:
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField customField = customFieldManager.getCustomFieldObject(10010);
IssueManager issueManager = ComponentManager.getInstance().getIssueManager();
MutableIssue currentMutableIssue = issueManager.getIssueObject(issue.getId());
currentMutableIssue.setCustomFieldValue(customField, valueToSave);
issueManager.updateIssue(currentMutableIssue.getReporterUser(), currentMutableIssue, EventDispatchOption.ISSUE_UPDATED, false);
currentMutableIssue.store();
The value in the custom field of the issue in Project B is set correctly every time; however:
- When the custom field is set to null (in ‘valueToSave’), then the field value is displayed on edit/view screen, and I can search it via JQL, etc. I also notice the index is auto trigger too after update.
- When the value is set to a non-null value, i.e. a number, the value is not displayed on the JIRA screen, and search not correct, until I manually update that issue in Project B! Of course, I don’t see any auto index!
What am I missing here? Thanks.