Is there an example of how we can use this method to update a core record upon validation of a certain version? For example, after validating from a version in CUSTOMER application, some fields of a record in MM application will be updated according to input. Have already searched on google but found no answer as the resource of t24 java development is very limited.
Below is my code:
package com.sofgen.scsb;
import java.time.LocalDateTime;
import java.util.List;
import com.sofgen.common.T24Rec;
import com.temenos.api.LocalRefClass;
import com.temenos.api.TBoolean;
import com.temenos.api.TString;
import com.temenos.api.TStructure;
import com.temenos.api.TValidationResponse;
import com.temenos.t24.api.hook.system.RecordLifecycle;
import com.temenos.t24.api.records.account.*;
import com.temenos.t24.api.records.country.*;
import com.temenos.t24.api.records.customer.*;
import com.temenos.t24.api.system.DataAccess;
import com.temenos.t24.api.records.mmmoneymarket.*;
/**
* TODO: Document me!
*
* @author ZEPHYRUS
*
*/
public class UpdateCoreTest extends RecordLifecycle {
@Override
public void defaultFieldValues(String application, String recordId, TStructure record, TStructure lastLiveRecord) {
// TODO Auto-generated method stub
}
@Override
public TValidationResponse validateRecord(String application, String recordId, TStructure record,
TStructure lastLiveRecord) {
// TODO Auto-generated method stub
return null;
}
@Override
public TBoolean updateLookupTable(String application, String recordId, TStructure record, TStructure lastLiveRecord,
TString lookupTableName, TString key, TString entryToDelete, TString entryToAdd, TBoolean sortAsNumber) {
// TODO Auto-generated method stub
return null;
}
@Override
public void updateCoreRecord(String application, String recordId, TStructure record, TStructure lastLiveRecord,
List<String> versionNames, TBoolean isZeroAuth, List<String> recordIds, List<TStructure> records) {
// TODO Auto-generated method stub
DataAccess da = new DataAccess(this);
AccountRecord acctRd = new AccountRecord(da.getRecord("ACCOUNT", "0082208301000172"));
String text = "Test Date:"+ LocalDateTime.now().toString();
int sizeOfRemark = 0;
sizeOfRemark = acctRd.getLocalRef("CNMB.C.REMARK").get().size();
if(sizeOfRemark==0){
acctRd.getLocalRef("CNMB.C.REMARK").add(text);
}else{
for(int i=0;i<sizeOfRemark;i++){
acctRd.getLocalRef("CNMB.C.REMARK").get(i).set(text);
}
}
versionNames.add("ACCOUNT,AMEND");
isZeroAuth.set(true);
recordIds.add("0082208301000172");
records.add(acctRd.toStructure());
}
@Override
public void setOverrideComparisonValue(String overrideMessage, List<String> messageDetails,
TString overrideComparisonValue) {
// TODO Auto-generated method stub
}
@Override
public String checkId(String idNew) {
// TODO Auto-generated method stub
return null;
}
@Override
public String formatDealSlip(String data, TStructure record) {
// TODO Auto-generated method stub
return null;
}
@Override
public TValidationResponse validateField(String application, String recordId, String fieldData, TStructure record) {
// TODO Auto-generated method stub
return null;
}
}
After compilation and deployment to the testing enviroment, error shows upon validation. Please check the image below. Screenshot of the version which the routine attached.