Hi Community, Is it possible to set default value in user picker custom field by the current user in customer portal? using behavior ?
I need to capture the current user on" Requested for " user picker custom field like on the above "Raise this request on behalf of" system field.
I tried it using this behavior , place it on Initialiser, mapped to Service Desk Project, because I just want it to become a default value. but no luck, any chances? When I try to check the console in chrome (f12)
When user is admin account, it can capture the user and place on the field, but when the user is customer account, it returns this error
This is the code:
import com.onresolve.jira.groovy.user.FormField
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
def requestorField = getFieldById("customfield_10385")
def currentUserName = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName()
requestorField.setFormValue(currentUserName)
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
def superior = getFieldById("customfield_10600")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName()
superior.setFormValue(currentUser)
I found above code and it populates jira login id. it works. However, I am looing to have default value as "last name, First name"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.