Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×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
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.