I'm not a developer so I don't know how to write scripts. I saw some of the sample ones in the link below, but I couldn't seem to find anything that could help me.
https://jamieechlin.atlassian.net/wiki/display/JBHV/JIRA%20Behaviours%20Plugin#JIRABehavioursPlugin-Setonefieldbasedonanotherfieldwithinformationprovidedbytheserver
Community moderators have prevented the ability to post new answers.
I haven't gotten a chance to try the script, but we decided to just stick with manually entering the component leads in. In the event that the component lead changes, we don't want to have to worry about the maitenance of the script.
Hi Brock,
here the script that you need
import com.atlassian.jira.bc.project.component.ProjectComponent FormField componentFF = getFieldById(fieldChanged) FormField userPickerFF = getFieldByName("User Picker Field") List<ProjectComponent> components = componentFF.getValue() as List if(components){ userPickerFF.setFormValue(components.first().lead) } else { userPickerFF.setFormValue("") }
Add this code into your behaviour associated to field "Components".Moreover, update "User Picker Field" with the correct name of your custom field. Since COmponent/s allows you to select multiple values, my script will update your custom field with the lead of the first selected component.
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
any update on that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Fabio for providing the script. I used your script on my existing behavior and it worked great!
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.
I am not sure why you are using Behaviour plugin? This seems like a simple script using a script runner (also by Jamie who created Behaviour plugin). If you download and install Script runner (which also means you need to install groovy language), then you just search in Answers for one of many examples in here for copying custom field using this plugin, that should do the trick
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.