I have a requirement to further process data added from the custom tables of the 'Table grid editor' plug-in. Ideally to write a JIRA plug-in that accesses the tables and retrieves the values stored in it. I've noticed that with each custom field I create through this plug-in a new table gets created. The problem I have is to find the corresponding table to each custom field(being able to find the table without hardcoding the table name). Is there any way to do this,perhaps a table that stores the required details?
The tablename is derived from the gd.tablename property and the contextid of the customfield.
Given that this add-on is manipulating data structures, we wanted to be sure that it would be harmless at all times for any data which is not related to the addon.
You could derive yourself the table name by using following query on the JIRA database
(sql to be adapted to your local database dialect - this is mysql)
* Context id can be found with
SELECT ctx.id, cf.cfname FROM jiradb.configurationcontext ctx inner join jiradb.customfield cf on ctx.customfield = concat("customfield_", cf.id) where cf.CUSTOMFIELDTYPEKEY = "com.idalko.jira.plugins.igrid:tableGridCFType"
* The tablename can be extracted from the generic configuration
SELECT ctx.id, gc.xmlvalue FROM jiradb2.configurationcontext ctx inner join jiradb2.customfield cf ON ctx.customfield = concat('customfield_', cf.id) inner join jiradb2.genericconfiguration gc ON gc.datakey = ctx.id where cf.CUSTOMFIELDTYPEKEY = 'com.idalko.jira.plugins.igrid:tableGridCFType' and instr(gc.xmlvalue, 'gd.tablename') > 0
The resulting table name is then
<configured table name> "_c" <context id>
Note that this poking around in the database does reveal implementation details which
will change in the future.
I raised therefore a new feature request in our jira to provide this information through a rest call
Please feel free to comment on that issue.
Atlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG