Welcome to Tempo’s Idea Portal! Your suggestions are valuable to us and help us make our products even better.
Below is a list of ideas for Tempo, so please search, review and vote for those that would help you the most. We encourage you to add an idea if you don’t see it listed. You can stay updated on the work we are doing here at Tempo by contributing to this page.
To learn more and see our Frequently Asked Questions, click here.
Implement yes.
This groovy listener worked for JIRA server version 7.2.4.
He found the first Team of the Assignee and entered him in the Team field.
It included calling a function that was no longer working.
It would be nice if he had a replacement or a new java or REST API:
ApplicationUser user = issue.getAssignee();
if (user != null) {
Collection allowedTeam = teamPermissionManager.getTeamsWhereUserHasPermission("tempo.teams.browse.team", user);
...
The whole script:
/**
* Onlio script
* JIRA version 7.2.4
* date: 3.1.2017
* listener: Tempo Team settings according to assignee.
* If the user is in more than one team, then the first one found is used.
* Sources: https://tempo-io.atlassian.net/wiki/spaces/KB/pages/1682080365/Tempo+Team+custom+field
*/
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.plugin.ComponentClassManager
import com.atlassian.jira.user.ApplicationUser
import static com.atlassian.jira.component.ComponentAccessor.*
/**/
def teamManager = getOSGiComponentInstanceOfType(getComponent(ComponentClassManager)
.loadClass("com.tempoplugin.team.api.TeamManager"));
def teamPermissionManager = getOSGiComponentInstanceOfType(getComponent(ComponentClassManager)
.loadClass("com.tempoplugin.team.api.permission.TeamPermissionManager"));
CustomField teamCF = getCustomFieldManager().getCustomFieldObjects()
.find { "com.tempoplugin.tempo-teams:team.customfield" == it.customFieldType.key }
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
/**/
//Issue issue = getIssueManager().getIssueObject("DEV-1"); // only for test in console...
ApplicationUser user = issue.getAssignee();
def oldId = teamCF.getValue(issue);
def newId = null;
if (user != null) {
Collection allowedTeam = teamPermissionManager.getTeamsWhereUserHasPermission("tempo.teams.browse.team", user);
Collection userTeams = teamManager.getTeamsForUser(user);
Collection newIdColl = userTeams.intersect(allowedTeam);
//newId = newIdColl.size() == 1 ? newIdColl[0].id : null;
newId = newIdColl[0].id;
}
teamCF.updateValue(null, issue, new ModifiedValue(oldId, newId as String), changeHolder);
//[user, newId] // only for test in console...