Confluence has been updated to version 6.15.9

JIRA ON-PREMISE

Table Grid Editor is a JIRA add-on allowing to store tabular data in the context of an issue.

It is available in Atlassian Marketplace.


To synchronize the data contained in such grids between the two instances is possible using the Table Grid API in the Incoming sync.

Check the following script example below for the details.


Incoming sync

import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.plugin.PluginAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
   
   


// get TGE custom field
// replace 'mytable' below with the name of the table grid
//
CustomFieldManager customFieldManager = ComponentAccessor.getOSGiComponentInstanceOfType(CustomFieldManager.class);
CustomField tgeCustomField = customFieldManager.getCustomFieldObjectsByName("mytable").get(0);
Long tgeCustomFieldId = tgeCustomField.getIdAsLong();
   
// get exalate user - replace 'exalate' below with the user name of your proxy user
UserManager userManager = ComponentAccessor.userManager
User exalateUser = userManager.getUserByKey("exalate")?.directoryUser

// Get access to the table grid api   
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor();
Class dataManagerClass = pluginAccessor.getClassLoader().findClass("com.idalko.jira.plugins.igrid.api.data.TGEGridTableDataManager");
def tgeGridDataManager = ComponentAccessor.getOSGiComponentInstanceOfType(dataManagerClass);
   


// Provide the data which needs to be added


Map<String, Object> row = new HashMap<String, Object>();
row.put("isummary", "Some summary");
row.put("iassignee", "admin");
row.put("istatus", "Done");
row.put("idue", new Date().getTime());
   

try {
  List<Long> rowIds = tgeGridDataManager.addRows(Long.valueOf(issue.id), tgeCustomFieldId, Arrays.asList(row), exalateUser);
} catch (Exception e) {
  // log an error if things go wrong, but continue with the synchronisation.
  log.error("** Failed to add data due to " + e)
}
   

   
// do the normal sync stuff.

issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)

Back to advanced configuration