Requirement:
Get All the fields and labels of Child Form
Solution:
Please use the below code snippet:
public void printChildFormColumn(long processInstanceKey) throws Exception{
tcFormInstanceOperationsIntf formInstanceOperationsIntf = oimClient.getService(Thor.API.Operations.tcFormInstanceOperationsIntf.class);
tcFormDefinitionOperationsIntf formDefinitionIntf = oimClient.getService(Thor.API.Operations.tcFormDefinitionOperationsIntf.class);
long processFormDefinitionKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processInstanceKey);
int processParentFormVersion = formInstanceOperationsIntf.getActiveVersion(processFormDefinitionKey);
tcResultSet resultGetChildFormDefinition = formInstanceOperationsIntf.getChildFormDefinition(processFormDefinitionKey, processParentFormVersion);
int countResultGetChildFormDefinition = resultGetChildFormDefinition.getRowCount();
for(int j = 0; j < resultGetChildFormDefinition.getRowCount(); j++){
resultGetChildFormDefinition.goToRow(j);
long childFormKey = resultGetChildFormDefinition.getLongValue("Structure Utility.Child Tables.Child Key");
int version = resultGetChildFormDefinition.getIntValue("Structure Utility.Child Tables.Child Version");
System.out.println("childFormKey :: " + childFormKey + " version :: " + version);
tcResultSet formFields = formDefinitionIntf.getFormFields(childFormKey, version);
for(int k = 0; k < formFields.getRowCount(); k++){
formFields.goToRow(k);
String column = formFields.getStringValue("Structure Utility.Additional Columns.Name");
String label = formFields.getStringValue("Structure Utility.Additional Columns.Field Label");
System.out.println("COLUMN :: " + column + " LABEL :: " + label);
}}}