Sharing issue with creator

Jamil Rahimov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 15, 2020

Let suppose customer wants create issue on behalf of someone and this customer has service-desk agent permission(can view issue, click buttons and so on.)

How can I share this issue with this customer?

The thing I wanna know who is customer? Current user, Reporter or who ?1.PNG

1 answer

1 accepted

0 votes
Answer accepted
Jamil Rahimov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 15, 2020

I did it using this script:
It reads logged in user and then adds to the issue as Participant:

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.user.ApplicationUser
import org.apache.log4j.Logger
import org.apache.log4j.Level
def CurrentLoggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issue = ComponentAccessor.getIssueManager().getIssueObject("//Issue Key")

def MyLog = Logger.getLogger("com.onresolve.groovy")
MyLog.setLevel(Level.DEBUG)

MyLog.debug(CurrentLoggedInUser)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def tgtField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "Participants"}
def changeHolder = new DefaultIssueChangeHolder()
def users = []
users.add(CurrentLoggedInUser)
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), users),changeHolder)

 

Suggest an answer

Log in or Sign up to answer