Closed GoogleCodeExporter closed 9 years ago
// Here I populate the SObject with data from Oracle
// I want to add 100 records to SObject rtl and do a Single SaveResult
// after the while loop how can I accomplish this?
List<SObject> records = new ArrayList<SObject>(100);
while (rs.next()) {
// Here I instantiate the existing SalesForce custom object
SObject rtl = new SObject();
rtl.setType("Rig_Timeline__c");
rtl.setField("Award_Rate__c", rs.getString("Award_Rate"));
rtl.setField("End_Date__c", rs.getString("End_Date"));
rtl.setField("HDR_Common_Name__c", rs.getString("Hdr_Common_Name"));
rtl.setField("Options__c", rs.getString("Options"));
rtl.setField("Rig_Code__c", rs.getString("Rig_Code"));
rtl.setField("Rig_Name__c", rs.getString("Rig_Name"));
rtl.setField("SEG_Common_Name__c", rs.getString("Seg_Common_Name"));
rtl.setField("Start_Date__c", rs.getString("Start_Date"));
// Here I add the record to the list...
records.add(rtl);
}
// Here I create the objects in Salesforce
SaveResult[] results = conn.create(records.toArray(new
SObject[records.size()]));
// Here I check the results...
for (int i = 0; i < results.length; i++) {
SaveResult saveResult = results[i];
// you insert proper code here
}
Cheers
Jesper Udby
Original comment by jesperudby
on 2 Feb 2013 at 11:36
Original issue reported on code.google.com by
Bart.Dew...@gmail.com
on 12 Jan 2012 at 5:41