Ok so here is the requirement . In my Create to Open workflow transition , I need to execute a script that will check for a selected option value . If the required option is selected then set a Custom text field value to current logged in user ,if not don't do anything . BTW the option custom field name is "CustomAction" and it has 3 options ie (Unlock,Reset,Create). If Unlock or Reset then only set the Text Value .
Seems clear, but I'm not sure what the question is. (If you're asking for someone to write the code for you, you could be out of luck - most people here would expect you to do it yourself and ask for help if you get stuck, not do the work for you)
import com.onresolve.jira.groovy.user.FormField
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.ComponentManager
log.warn( "line 1" )
def currentUserName = ComponentManager.getInstance().getJiraAuthenticationContext().getUser().getName()
log.warn( "line 2" )
FormField hiddenfield = getFieldByName("HiddenStateField")
log.warn( "line 3" )
FormField UserAccountaction = getFieldByName("User Account action")
log.warn( "line 4" )
if(UserAccountaction.getFormValue() == 'Unlock Account' || UserAccountaction.getFormValue() == 'Reset Password')
{
log.warn( "line 3" )
log.warn( UserAccountaction.getFormValue() )
hiddenfield.setFormValue(currentUserName)
}
HiddenStateField is the TextField where I need it stored. Me using JIRA 5.1.2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So what's not working? What field is the behaviour applied to?
Can you use the correct tag, ie behaviours plugin not script runner 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.