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:
What am I missing here? Thanks.
Hi
I had the same problem like you. At the end I decided to reindex the issue manually when I change a customfield value. just add the following Codelines
final IssueIndexingService issueIndexingService =
(IssueIndexingService) ComponentAccessor.getComponent(IssueIndexingService.class);
issueIndexingService.reIndex(issue);
This should work just fine
Try to update the issue using issueService instead of issueManager.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually it looks like there are some issue with the code logic causing this problem. Everything seems to work now. Thanks for the suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually it's not working again - look like one day it works, one day doesn't. I have tried different approaches, but none work... In fact I found similar issue on this site and I post my problem there - https://community.atlassian.com/t5/Answers-Developer-Questions/Update-an-issue-field-in-a-listener-changes-are-not-made/qaq-p/566449
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Describe please the type of your custom field. What is Search Template set for this custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.