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)
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline 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.