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 ?
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)
Stand out as a skilled Confluence Cloud administrator. The Confluence Administration for Cloud certification proves you can configure permissions, manage site and space settings, and monitor activity—ensuring secure, effective collaboration for your team.
Start here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.