Using the solution found here: https://community.atlassian.com/t5/Answers-Developer-Questions/Check-if-linked-issue-is-in-a-certain-project/qaq-p/564203
I have added the below groovy script to the Set Field Value of Related Issues Post-function being used in my workflow so that I can conditionally execute the function when the Linked issue is in a specific project.
Here is the script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
def io = ComponentAccessor.getIssueManager().getIssueObject(issueObject.getKey())
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
issueLinkManager.getOutwardLinks(io.id).any{it.destinationObject.getProjectObject().getKey() == 'S1S2'}
What I am finding is that the array is always null, so the last line will always be false.
It is properly resolving the issue, but the linked issue is not resolving.
When i change the last line to getInwardLinks I get a non-null array, but the information does not look correct and still resolves as false.
My issue has an "addresses" link.
Hi Richard,
With the simplified API of JMWE, your script can be much simpler.
relatedIssue?.project?.key == "S1S2"
relatedIssue here refers the related/linked issue being processed by the post-function, in turn.
Regards,
Radhika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.