I am new script Runner and I looking for a solution or a script to do following:
1. Components Field has multiple values such (JIRA, APP)
2. Get the Component leads for each of the Components in Component field
3. Copy the Component leads to User field(Multi-User Picker)
Thanks
Hi Yogi,
I might be able to help you here, but first please advise what is the version of your Jira?
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, assuming we are talking about a scripted field, here's what you do:
return issue.getComponents().collect{it.getComponentLead()}
Make sure you choose "User Picker (multiple users)" template when creating your scripted field. Also set the field's searcher to "User Picker & Group Searcher".
If this you need a post function instead, then use this code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("name of your user field")
issue.setCustomFieldValue(cf, issue.getComponents().collect{it.getComponentLead()}
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Yogi Patel Great news! Glad I could help. Please mark this solution as "Accepted" if it resolved your issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.