Hi Team
I have Issue picker field in Service Desk portal and when customer creating a ticket from portal they are selecting existing ticket from Issue picker field, then I need to assign this tickets to same from Issue picker.
Ex: I have a issue key A-100 and the same assign to (user1), when I am creating new ticket I selected A-100 from JIRA issue picker, so I need to assign A-101 ticket to (user1) automatically.
I written a script but its not working
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
// Set log level
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)
final relatedIssueName = 'OCM Ticket'
def issuPickerField = getFieldByName(relatedIssueName)
def issuePickerFieldValue = issuPickerField.value
def userName = ComponentAccessor.issueManager.getAssignee(issuePickerFieldValue as String)
def user = ComponentAccessor.userManager.getUserByName(userName)
issue.setAssignee(user)
Please try this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
// Set log level
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)
final relatedIssueName = 'OCM Ticket'
def issuPickerField = getFieldByName(relatedIssueName)
def issuePickerFieldValue = issue.getCustomFieldValue(issuPickerField)
def user = ComponentAccessor.issueManager.getIssueByKeyIgnoreCase(issuePickerFieldValue.key).getAssignee()
issue.setAssignee(user)
Hope this works. Please accept the answer if it does.
Regards,
Anzar
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.