Hi!
I'm trying to add Custom Listener that would execute code after Issue Updated event occurs. The problem is that I don't know how to change linked issue's priority.
I would appreciate any help!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*
import com.atlassian.jira.event.type.EventDispatchOption
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Priority"}
if (change && event.issue.issueType=="Zadanie") {
def issueManager = ComponentAccessor.getIssueManager()
def issueBNGObj= issueManager.getIssueObject(event.issue.key)
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
for(item in issueLinkManager.getOutwardLinks(event.issue.getId())){
def linkedIssue= item.destinationObject
def linkedIssueObj= issueManager.getIssueObject(linkedIssue.key)
def projName=linkedIssue.getProjectObject().name
if(projName=="Rejestr Potrzeb"){
linkedIssueObj.setFieldValue("priority", issueBNGObj.priority) // error lights up here
issueManager.updateIssue(event.user, linkedIssueObj, EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
}
On the line that's erroring for you:
linkedIssueObj.setFieldValue("priority", issueBNGObj.priority) // error lights up here
Try using this instead:
linkedIssueObj.setPriority(issueBNGObj.priority)
Priority is a system field, so you shouldn't need to use the .setFieldValue method, but the .setPriority() one instead. See the MutableIssue class for more methods like that.
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.