Hi everyone,
I've been looking everywhere to find a solution for my problem. I have a custom field (user picker) called "responsible" and I need it to be pre-populated with the "reporter" (or current user) value on issue creation. I can't just copy the value as part of a post-function since users should have the possibility to change the value right away (if they are not the person being responsible)
There used to be a plugin addressing the problem which seems to outdated.
I've been trying to achieve this with the behaviours plugin but with no success.
FormField formAutor = getFieldByID("reporter") FormField formAG = getFieldByName("Auftraggeber") if(formAG.getFormValue() == ""){ formAG.setFormValue(formAutor.getFormValue()) }
Any clues or is this a real piece of work? If yes, I have to check with my customer if this request is a must-have...
Thank you,
Christian
This should be possible using Behaviours plugin .
Try the below script , even add some logging (you will have to click on enable logging on the behaviours plugin )
FormField formAutor = getFieldByID("reporter") FormField formAG = getFieldByName("Auftraggeber") if(!formAG.getFormValue()){ formAG.setFormValue(formAutor.getFormValue()) }
Do I have to active another logging behaviour (set a logger to debug?)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes there is a enable logging link on the behaviours page
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know, just wanted to check if I had to set a JIRA logger to "debug" instead of warning in order to see the entries in the log file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok , so is the script working ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, it's not working. Can't view the log right now since the server admin has already gone home:-) I even tried without the if clause with no result. The value doesn't get copied.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any chance of retrieving the current reporter (or current user) without using the field "reporter" on my issue create screen? My customer doesn't want the creator field being displayed...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes you can use the following line
User currentUser = componentManager.getJiraAuthenticationContext().getUser()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've achieved it by using:
import com.atlassian.jira.ComponentManager FormField formAG = getFieldByName("Auftraggeber") currUser = ComponentManager.getInstance().getJiraAuthenticationContext().getUser() currUserName = currUser.getName() if(!formAG.getFormValue()){ formAG.setFormValue(currUserName) }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great :)
Hey can you try the below code .. it wont make much difference
import com.atlassian.jira.ComponentManager FormField formAG = getFieldByName("Auftraggeber") if(!formAG.getFormValue()){ formAG.setFormValue(ComponentManager.getInstance().getJiraAuthenticationContext().getUser().getName()) }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Christian Czaia _Decadis AG_ i just updated the code to latest classes and it worked
Thanks alot!!
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FormField
FormField formAG = getFieldByName("latest user")
if(!formAG.getFormValue()){
formAG.setFormValue(ComponentAccessor.getJiraAuthenticationContext().getUser().getName())
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
can someone advise me where to get Behaviours plugin, please? I have looked up on Atlassian marketplace but with no success. Nothing like Behaviours plugin for Jira.
Thank you in advance,
L.
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.
Hi,
I have almost similar issue. Could someone please help me.
My issue is, I have a custom field and a system field (Reporter). I would have a value in my custom field and I want that value to auto populate to the Reporter field if that user(value) listed in custom field maches to the user list in Reporter field.
How do I do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script worked for me also in the Behaviours plugin. In addition, I would like to choose a different user in the custom field (user picker) if it is not the Reporter. Is there a simple "else" statement I could use?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got a typo:
FormField formAutor = getFieldById( "reporter" ) FormField formAG = getFieldByName( "Auftraggeber" ) if (!formAG.getFormValue()){ formAG.setFormValue(formAutor.getFormValue()) } |
I had ID :-)
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.
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.