I've got a tricky question regarding JIRA user properties and am curious if anybody could send me in the right direction:
I'd like to store user properties (e.g. phone, department, hardware configuration, cost center, etc.) in JIRA and - now the tricky part - PREFILL an issue within the issue-create screen with these properties.
- I do know, that there are several plugins (e.g. the JIRA Toolkit Plugin) which allow you to copy user properties to fields within POSTFUNCTIONS,
BUT the combination is currently the challenge.
1.) Only prefill content from user properties (granting reporter the possibility to overwrite them manually);
2.) Prefill in the create-screen (trigger "on create")
Anyone with a concrete idea will earn some karma points and my everlasting gratitude!
Hi. I recommend the Behaviours plugin (https://marketplace.atlassian.com/plugins/com.onresolve.jira.plugin.Behaviours). I used it to prefil the user Title field in an edit transition. Here is the snippet of code I used as the server side validation script. Worked in JIRA 5.1
import com.atlassian.jira.ComponentManager import com.atlassian.jira.user.UserPropertyManager ComponentManager componentManager = ComponentManager.getInstance() UserPropertyManager userPropManager = componentManager.getUserPropertyManager() // Default values for Signee Name and Title FormField formSigneeName = getFieldById("customfield_10460") FormField formSigneeTitle = getFieldById("customfield_10553") def currentUser = componentManager.jiraAuthenticationContext.getLoggedInUser() formSigneeName.setFormValue(currentUser.getDisplayName()) formSigneeTitle.setFormValue(userPropManager.getPropertySet(currentUser).getString("jira.meta.title"))
You can get the requested feature by using servlet and JQuery.
On a create screen you would want to prepopulate JIRA Custom Fields "Phone", "Department" from user properties (User may be reporter or user in usercustomfield or current user)
You can pass which user (User's whose properties need to be populated) as input to servlet (This can be done using java script and JQuery) - Sample url for servlet -http://xxx.xxx.com/plugins/servlet/servlettName?employee=yyyy
OR in the servlet code you can refer currentuser - Easy & simple
Then in the servlet code, you can fetch the properies related to required user.
Then from output/ servlet response, you can autofill the JIRA Customfields using script/ JQuery.
Note: You will have to call this servelt on any Field on the create screen using Jquery/ script
JIRA SERVLET MODULE - https://developer.atlassian.com/display/JIRADEV/Servlet+Plugin+Module
after having a closer look to your proposal I am doubtingabout the servlet-solution. For me it seems that I need to have a plugin or backend-script being written for that. Something which is deployed to the JIRA-server, right?
PS: The properties shall be taken from "currentUser" alway.
On 10/Apr/2013 we'll release JJupin 2.5.3. Our new functionality, LiveFields, will go out of the beta.
You will be able to manipulate the screen on create:
and you will be able to pre-fill the screen with your stuff (be there properties!)
Getting properties from user should be pretty straightforward: http://confluence.kepler-rominfo.com/display/SIL/getUserProperty
If you can't wait, contact us and we'll provide you the snapshots :)
Hi Kai, just keep in mind that the release is on 10th of April. I understand perfectly, but in this case you can build your own plugin, add a rest resource to return the properties from the user (it's a 10 minutes job), and do whatever you like in JQuery (the disadvantage is again non-portability across JIRA versions).
check this inbuild rest api
another way is you can develop your own REST plugin, check the doc
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot