Hello everybody i would like to set the Assignee from a user picker custom field see code Below but nothing hapens
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
def cField=ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_10401")
def cFValue = issue.getCustomFieldValue(cField) as ApplicationUser
issue.setAssignee(cFValue)
Hello @Heiko Treuner
Where do you do it? In post functions, in listeners, in the console?
If it's a post-function it should be upper then 'Update change history for an issue and store the issue in the database.' function. In other cases, you should use issue update methods. For example
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.setAssigneeId("userName")
def updateValidationResult = issueService.validateUpdate(user, issue.getId(), issueInputParameters)
if (updateValidationResult.isValid()) {
issueService.update(user, updateValidationResult)
}
Hey thaks for ur answer i used it in the create post function and have it before 'Re-index an issue to keep indexes in sync with the database. ' but nothing happens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to move your function to the first place just before 'Creates the issue originally.' function
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.
def cField=ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_10401")
With this snippet you get a specific field where you can do what you want e.q. set other fields like the asignee field. If th fetched value a user picker field
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.