With all the preamble code that makes the following work, the listener will always get the destination (outward) linked issues of a certain link type and update fields appropriately in them. HOWEVER, it never shows "updated just now" or reflects in the history or activity. What am I missing? I've grepped google for how to fire an event but can't seem to get what I am looking for. This is with Jira 7.8.2 and ScriptRunner 5.4.12. I get no failures but it just doesn't seem to fire an event for the target issue that it was updated.
def changeHolder = new DefaultIssueChangeHolder()
startDateField.updateValue(null, linkedIssue, new ModifiedValue(linkedIssue.getCustomFieldValue(startDateField), newDate), changeHolder)
issueManager.updateIssue(null, linkedIssue, EventDispatchOption.ISSUE_UPDATED, true)
Hi @Mike Rathwell,
Try to update linked issue's value with this code, not using changeHolder.
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
linkedIssue.setCustomFieldValue(startDateField,newDate)
issueManager.updateIssue(user, linkedIssue, EventDispatchOption.DO_NOT_DISPATCH, false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That linked issue is defined earlier in the script where I am getting outward links from the current issue being worked on. The code looks like this:
List<IssueLink> allOutIssueLink = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId());
for (Iterator<IssueLink> outIterator = allOutIssueLink.iterator(); outIterator.hasNext();) {
IssueLink issueLink = (IssueLink) outIterator.next();
MutableIssue linkedIssue = issueLink.getDestinationObject() as MutableIssue;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You use the updateValue() method that is why the history is not generated. It should be like this:
linkedIssue.setCustomFieldValue(startDateField, newDate)
issueManager.updateIssue(null, linkedIssue, EventDispatchOption.ISSUE_UPDATED, true)
You can read about updating issues in Jira in my article:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try the answer of @Tansu Akdeniz. Concerning your question. You can not see history because UpdateValue does not generate history. It is written in my article
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Alexey... As I noted in my rather large script, now that I grok this better with your help, I ended up using both as there is one case in the script that I want it to put in the history... and another that I don't... for reasons...
Thanks for you help and attention to my plight
Best,
Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alexey Matveev and @Tansu Akdeniz, thank you both. I had looked at the "setCustomFieldValue()" call and I guess I read it upside down. To get it clear in my (admittedly tiny) mind:
I am going to try to accept BOTH your recommendations as the answer but if not, will upvote both of you. I ended up using Alexey's updateIssue() params in one place in my script and Tansu's in another.
Thank you both!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.