Hi
I am trying to create a notification scheme that will send a notification to one of five "tech approver" groups created in JIRA, when the ticket reaches a certain part of the workflow (ie "awaiting tech approval").
I have created a post-function on the transition to the "awaiting tech approval" stage. The post-function fires an event, which in turn notifies the group specified in a custom field group picker in the ticket.
The problem is that when entering the group in the field, you can see ALL of JIRA's groups. Which is a lot more than five.
Is there a way of limiting the number of groups?
Alternatively, I would like to create a dropdown custom field picker, where the user selects an "area" that is mapped to the appropriate group. (ie picking "Enterprise" in the field would then result in a post-function mapping Enterprise to "tech-notify-enterprise"). Is there any way of doing this?
Thanks for your time.
==== UPDATE FROM Oct 29th, 2018 ====
Please scroll in comments for an updated answer and an alternative method.
==== ORIGINAL CONTENT ====
Hi Adam,
My suggestion would be to edit your permission scheme and grant the "Assignable User" permission to a group custom field value as described below:
That would only allow users from the group in the custom field to be assignee. Please note that this will apply to the whole project and you'll need to carefully prefill this custom field with the relevant group at all time! The custom field value could be easily changed from a status to another using post functions.
Would that work?
Thanks
Thanks very much Mickey. I don't think that would work for us because we still require the ticket to be assigned to someone else, we're just looking to notify one of a few groups. However, that is a really interesting feature and one I might use in future!
Best wishes and Merry Christmas
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
Thanks for your feedback and sorry for my delayed response!
You have a happy new year and best luck with Jira :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks you too Micky.
In the end this was the solution I devised with the help of a colleague and the community.
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.ModifiedValue;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
MutableIssue issueToUpdate = (MutableIssue) issue;
// create the map of Change Area names to approval groups
def approvalGroupMap = [
"TA Group 1" : "tech-approval-group1",
"TA Group 2" : "tech-approval-group2",
"TA Group 3" : "tech-approval-group3",
"TA Group 4" : "tech-approval-group4",
"TA Group 5" : "tech-approval-group5"
];
// get the value of the "Change Area" field
def changeAreaFieldObject = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_XXXXX");
def changeArea = issue.getCustomFieldValue(changeAreaFieldObject).toString();
//configure and define the value taken from the "Change Area" field as a group, rather than a simple string (this is necessary)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def groupManager = ComponentAccessor.getGroupManager()
def group = groupManager.getGroup(approvalGroupMap[changeArea])
//taking the group value defined immediately above, use it to set Techical Approvers Group field
def tgtField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjects(issue).find {it.name == "Technical Approvers Groups"}
def changeHolder = new DefaultIssueChangeHolder();
def mv = new ModifiedValue(issue.getCustomFieldValue(tgtField), [group]);
tgtField.updateValue(null, issue, mv,changeHolder);
//test with a return group to make sure it is working.
return group
What all this allows me to do is have a user-friendly and limited choice custom field, with option names I can control and which are mapped on the back end to specific JIRA groups.
Hope this helps anyone thinking about doing something similar!
Best wishes
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, interesting! Thanks for sharing!
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 @Adam Gaudry, how did you managed to populate the Assignee field based on users on its group?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alvin
Sorry for the delayed response. I didn't populate the assignee field; what my solution does is populate a group field based on a single choice, drop-down select list.
It's a bit like this:
Custom field A = single choice, drop-down select list. There are 5 different options in this field, so you can select either option 1, 2, 3, 4, or 5.
Custom field B = single group field.
Custom field C = this is a scripted field configured using Scriptrunner, that essentially takes the value of the choice in Custom field A and turns it to string, so it can be mapped to groups for Custom field B.
Then in practice, when sometime makes a choice in Custom Field A, the scriptrunner field maps it to a group (according to its script, see above for more info), and the group gets selected in Custom field B.
Once that has run, I have set up the notification scheme so that the group defined in Custom field B is notified when a ticket is submitted for review.
Hope that makes sense.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Adam Gaudry , do you have sample code to work with? Thank you
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.
Thanks @Adam Gaudry
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.