Hello there ,
For a few days I am trying do make post function with Sript Runner that will make a link based on issues defined in CF.
I am almost there but i cant get proper type into the remoteUser variable.
Here is the code:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.security.JiraAuthenticationContext import com.atlassian.crowd.embedded.api.User def componentManager = ComponentManager.getInstance() def issueLinkManager = componentManager.getIssueLinkManager() def issueManager = componentManager.getIssueManager() def customFieldManager = componentManager.getCustomFieldManager() def jiraAuthContext = componentManager.getJiraAuthenticationContext() def long tpIssueLinkType = 10450 def MutableIssue cfIssue def User currentUser = jiraAuthContext.getUser().getDirectoryUser() CustomField customField = customFieldManager.getCustomFieldObject(13618) issue.getCustomFieldValue(customField).each { iscr -> cfIssue = issueManager.getIssueObject(iscr) createIssueLink(cfIssue.getId(),issue.getId(),tpIssueLinkType,1L,currentUser) }
With this i get:
No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.createIssueLink() is applicable for argument types: (java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, com.atlassian.jira.user.BridgedDirectoryUser) values: [131727, 132022, 10450, 1, MPokorsk:10105]
and if I change
def User currentUser = jiraAuthContext.getUser().getDirectoryUser()
to
currentUser = jiraAuthContext.getUser()
i get
No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.createIssueLink() is applicable for argument types: (java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, com.atlassian.jira.user.DelegatingApplicationUser) values: [131727, 132022, 10450, 1, MPokorsk(mpokorsk)]
How to get proper type for remoteUser ??
void createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, com.atlassian.crowd.embedded.api.User remoteUser)
Could You help me with this ?
Community moderators have prevented the ability to post new answers.
I hope I am not too late :D
I was looking almost for the same thing - is how to get that remote user, but a with a new method because the old is deprecated. So there are two ways to get that remote user.
The old one (Deprecated Since v6.0)
def remoteUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
And the new one
def remoteUser = ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser()
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.