Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21: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.
×I'm trying to inherit values when creating a linked issue, primarily the assignee since this can't be set in an issue collector, per Atlassian's documentation.
I've added this into the workflow scripted post function to no avail:
import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() issueLinkManager.getOutwardLinks(issue.id).each {issueLink -> def linkedIssue = issueLink.destinationObject issue.assignee = linkedIssue.getAssignee() }
JIRA doesn't like that and won't let me use the workflow transition on issues with that function in place. Error says:
Property 'issueLink' not found
It seems that you have tried to perform an illegal workflow operation.
I'm open to other alternatives, but scriptRunner just seemed to be the best route without sinking more money into add-ons.
Hi Robert,
You can use a script listener that will listen for Issue Created events and use as a script the following
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue def issue = event.issue as MutableIssue def issueService = ComponentAccessor.issueService def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def issueInputParameters = issueService.newIssueInputParameters() // this is in question since there can be more than one issues linked with a different assignee each one def assigneeToSet = ComponentAccessor.getIssueLinkManager().getLinkCollectionOverrideSecurity(issue)?.allIssues?.getAt(0)?.assignee issueInputParameters.with { projectId = issue.projectId summary = issue.summary issueTypeId = issue.issueTypeId reporterId = user.name assigneeId = assigneeToSet?.key } def validationResult = issueService.validateUpdate(user, issue.id, issueInputParameters) assert !validationResult.errorCollection.hasAnyErrors() def issueResult = issueService.update(user, validationResult) log.info "Issue updated: ${issueResult.issue}"
Of course you can edit the script above to use it as a Post function.
The main question here is what is happening if you create an issue with other 2 linked issues that each has a different assignee. Whom are you going to add ?
In the example above I assume that you will get the assignee of the first issue.
Please let me know if this does the trick.
regards, Thanos
That appears to be working for me, Thanos. Thank you very much.
In regards to your question with the issue links and potentially having more than one, we're actually creating the issues from JIRA issues, using an issue collector which sets an individual link in the background so, in theory, we shouldn't ever get one with multiple links. We're stretching the systems legs to use it for assets and their change requests.
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.