I'm trying to fill in certain fields (like Product Manager, Dev lead, QA lead, etc.) when an issue is created. These values would probably be derived from project roles. How can I do this?
As I know there is no exact solution for that issue (+ you should define what to do if there is more than one user inside project role), so the easiest way is to implement the logic as a postfunction using script runner. see https://jamieechlin.atlassian.net/wiki/display/GRV/Post+Functions for details.
Thanks for the response. We have this installed already and this would probably be the best way forward.
Handling multiple people in a role is a good reason to script it so we can handle exceptions with ease.
To be specific, do you know how I can (1) change in custom fields and (2) access the project Roles via script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. If you are doing that in postfunction - something like
String customFieldName = "customfield_11112"; CustomField cf = customFieldManager.getCustomFieldObject(customFieldName); issue.setCustomFieldValue(cf,value);
2. refer to
https://answers.atlassian.com/questions/60150/how-to-get-project-role-object-using-api-method-in-behaviours-plugin
and
https://docs.atlassian.com/jira/latest/com/atlassian/jira/security/roles/ProjectRoleManager.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alexey,
You've given me the right answer so I've marked the question as answered so you can have your karma (whats the Reddit to Atlassian karma conversion ratio??) but I had two more questions.
How would I access the component lead and utilize this information in Script Runner?
Is there documentation on how to access this data?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. You can use https://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/project/component/ProjectComponentManager.html#find(java.lang.Long) to get project component by id, https://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/project/component/ProjectComponent.html - from project component itself you can find lead
2. I use https://developer.atlassian.com/display/JIRADEV/JIRA+Plugin+Guide and https://docs.atlassian.com/jira/latest/ for jira + google search
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.