how to get all the data from table grid editor by using java API or jira rest api

Vishwanath_Pal June 29, 2017

see i have tryed this but whenever i print this i get total object are available instead of get all the values available in grid table...

Long l = Long.valueOf(10001);
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField customField = customFieldManager.getCustomFieldObject(l);
Object value = issues.get(0).getCustomFieldValue(customField);
// there is two column entry in my table grid editor so getting value =2
System.out.println("custom field TGE value::::::::::"+value);
//buti want the actual value available in grid table. I am getting other custom field value but in case of grid table i getting only total column count
 

 

1 answer

1 vote
Ihor Uksta June 30, 2017

Table Grid customfield stores its data in separate db table which you've defined in your configurations. And API that you used is getting values from jira db table "customfieldvalue". Therefore to get values from TGE field you should use its own API. Here is a nice example of script that might cover your needs:

https://wiki.idalko.com/display/TGPD/Read+Grid+Data

Vishwanath_Pal June 30, 2017

about TGE.. information is very helpfull and the link (https://wiki.idalko.com/display/TGPD/Read+Grid+Data) you have mention i have tried that in script runner it is working great. Now i am thinking  to get TGE value using JIRA REST API and i have done it my using REST Plugin Module (https://developer.atlassian.com/docs/atlassian-platform-common-components/rest-api-development/rest-plugin-module) now the problem is when it ask for Enter REST Path /restservice: : while selecting plugin module which is no.14 so i have entered complate jira rest api url formate with grid_id and issue_id and i am getting TGE value in json format but it's fixed in:

<rest name="Rest Service" i18n-name-key="rest-service.name" key="rest-service" path="/http://localhost:2990/jira/rest/idalko-igrid/1.0/grid/10001/issue/10000" version="1.0">

  <description key="rest-service.description">The Rest Service Plugin</description>
</rest>
how can i pass grid and issue id (grid/10001/issue/10000) dynamically in "path".
Any suggestion or link would be great help..
thanks in advance

Suggest an answer

Log in or Sign up to answer