I would like to set default value of user picker field as a current user.
What I'm trying to do is to attach following behaviour to the field I want to initiate with default value:
import com.onresolve.jira.groovy.user.FormField import com.onresolve.jira.groovy.user.FieldBehaviours import com.atlassian.jira.ComponentManager def requestorField = getFieldByName('Requestor') def currentUserName = ComponentManager.getInstance().getJiraAuthenticationContext().getUser().getName() requestorField.setFormValue(currentUserName)
But it does not work for some reason.
Is there any way to do that? Maybe I'm doing something wrong in my script?
Thanks
False alarm. Problem appeared to be with the behaviour mapping.
Just a guess - have you tried setting the field's value to User object instead of String, that is, remove the ".getName()" part?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
already tried this. it didn't help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hehe, i was stabbing in the dark anyway :) Glad you got it resolved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Second guess: replace single quotes with double quotes?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Andris, thanks for your prompt reaction. Issue has been resolved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry, it turned out to be related to behaviour mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What you have should work - looks ok to me anyway... What version of jira, version of plugin?
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.