/
Synchronize Custom Field Values
Synchronize Custom Field Values
Synchronize Custom Field Values
/**
* Available since TGE 1.19 only!
*/
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.plugin.PluginAccessor
// get current user
JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getOSGiComponentInstanceOfType(JiraAuthenticationContext.class);
Object userObject = jiraAuthenticationContext.getLoggedInUser();
User user = userObject instanceof ApplicationUser ? ((ApplicationUser) userObject).getDirectoryUser() : (User) userObject;
// get data manager
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor();
Class dataManagerClass = pluginAccessor.getClassLoader().findClass("com.idalko.jira.plugins.igrid.api.data.TGEGridTableDataManager");
def tgeGridDataManager = ComponentAccessor.getOSGiComponentInstanceOfType(dataManagerClass);
// initialize synchronization
StringBuilder result = new StringBuilder();
try {
tgeGridDataManager.synchronizeCustomFieldValues(user);
result.append("Custom field values synchronization is initialized.\n");
} catch(Exception e) {
result.append("Custom field values cannot be synchronized due to error: " + e.getMessage() + "\n");
}
println(result.toString());
return result.toString();
, multiple selections available,
Related content
Add Rows
Read with this
TGNG Server/Datacenter and TGE Server/Datacenter to TGNG Cloud migration
TGNG Server/Datacenter and TGE Server/Datacenter to TGNG Cloud migration
More like this
Java API: Groovy script examples
Java API: Groovy script examples
Read with this
Query Jira values to add dynamic grid data
Query Jira values to add dynamic grid data
More like this
Table Grid Migration
Table Grid Migration
More like this
Version 1.21.10
Version 1.21.10
More like this