Hi,
I am linking issues by using the blow code
issueLinkManager.createIssueLink(issue.getId(),issueObject.getId(),10003,1,issue.getAssignee());
This line of code links the issues and makes the assignee as the action maker.
I need to set a specific user to be the action maker of the linking. How to update the above code to do so?
Community moderators have prevented the ability to post new answers.
You should be able to get the user like in the following snippet and replace "issue.getAssignee()" with "user" like on the last line:
import com.atlassian.jira.component.ComponentAccessor def userManager = ComponentAccessor.userManager def user = userManager.getUserByKey("admin") // get by username below, above gets user by key (incase user is renamed) //userManager.getUserByName("admin") issueLinkManager.createIssueLink(issue.getId(), issueObject.getId(), 10003, 1, user);
Dear @Adam Markham [Adaptavist],
I tried your script but got the below error:
[scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: CR-9423, actionId: 1881, file: <inline script> groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.link.DefaultIssueLinkManager.createIssueLink() is applicable for argument types: (java.lang.Long, java.lang.Long, java.lang.Integer, java.lang.Integer, com.atlassian.jira.user.DelegatingApplicationUser) values: [88828, 108907, 10003, 1, jiraadmin(jiraadmin)]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your probably on JIRA 6. They changed User to ApplicationUser for JIRA 7. For 6 Please use:
import com.atlassian.jira.component.ComponentAccessor def userManager = ComponentAccessor.userManager def user = userManager.getUserByKey("admin").directoryUser // get by username below, above gets user by key (incase user is renamed) //userManager.getUserByName("admin") issueLinkManager.createIssueLink(issue.getId(), issueObject.getId(), 10003, 1, user);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Adam Markham [Adaptavist],
It works fine!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issueLinkManager.createIssueLink(issue.getId(), issueObject.getId(), 10003, 1, user);
How to create inward link name using this createIssueLink?
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.