Hi,
can anyone provide a complete script to create links between the current issue and another one (provided in a custom field) using a scriptrunner post function?
I have tried 57843583 scripts, none of them work, and I can't figure out what the problem is. I am already using postfunctions to set the summary based on certain field values and that's working without any problems.
Hi Superuschi,
I created the following script in a post function that will get the value from a custom field (text) and link it to the current issue whenever the user performs the desired workflow transition.
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("TextFieldA")
def issueKey = issue.getCustomFieldValue(customField) as String
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueManager = ComponentAccessor.getIssueManager()
def issueToLink = issueManager.getIssueObject(issueKey)
issueLinkManager.createIssueLink(issue.id, issueToLink.id, 10000, 1, user)
createIssueLink is doing all of the work here, with the following parameters:
Simply change the parameters to the ones that fit your need.
Ohh thank you very much. Works as intended :-)
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.