JIRA provides you the functionality to create different type of custom fields. One of them being, user-picker. We can define which users would appear in the picker from the configuration. For example, groups or project roles. But, if we want to set/populate the current user as the default user, then JIRA doesn't provide this in the configuration. To achieve this, we can have a simple behaviors as follows:
import com.atlassian.jira.component.ComponentAccessor def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def userPickerFieldOne = getFieldById("customfield_13501") def userPickerFieldTwo = getFieldById("customfield_13500") userPickerFieldOne.setFormValue(currentUser.username) userPickerFieldTwo.setFormValue(currentUser.username)
Go to the Behaviors in the JIRA administration section, add a new behavior, and paste the above code in the initialiser. That's it. Don't forget to change the
customfield_13501 with your custom field ID.