Monday, 11 March 2019

OIM API - How to Add Data in Child Form?

public void addDataInChildForm(long processInstanceKey) throws Exception {
    String childTableName = "UD_LDAP_ROL"; //child table name 
    String columnName = "UD_LDAP_ROL_ROLE_NAME"; //column name
    String columnValue = "TestRole"; //column value 
    
    tcFormInstanceOperationsIntf formInstanceOperationsIntf = Platform.getService(Thor.API.Operations.tcFormInstanceOperationsIntf.class);
    
  long processFormDefinitionKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processInstanceKey);
int processParentFormVersion = formInstanceOperationsIntf.getProcessFormVersion(processInstanceKey);

tcResultSet childFormDefinition = formInstanceOperationsIntf.getChildFormDefinition(processFormDefinitionKey,processParentFormVersion);

for(int i = 0; i < childFormDefinition.getRowCount(); i++){
childFormDefinition.goToRow(i);
String childFrmName = childFormDefinition.getStringValue("Structure Utility.Table Name");

if(childFrmName.equalsIgnoreCase(childTableName)){
long childKey = childFormDefinition.getLongValue("Structure Utility.Child Tables.Child Key");

HashMap addAttr = new HashMap();
addAttr.put(columnName, columnValue);

formInstanceOperationsIntf.addProcessFormChildData(childKey, processInstanceKey, addAttr);
System.out.println("Added successfully!!!");
}
}
 }

1 comment:

  1. This is great, thanks for the share. Also, if you are visit our website if you are looking for assistance with your nursing assignment:

    Nursing Assignment Help

    ReplyDelete