how to return number of rows or records after using upsert

use upsert result attribute CREATED to count number of records which got created and number of records which got updated
Integer createdCount = 0;
Integer updatedCount = 0;
List uResults = Database.upsert(leads,false);
for(Database.upsertResult result:uResults) {
if (result.isSuccess()) {
if(result.isCreated())
createdCount++;
else
updatedCount++;
}

Recent comments

Who's new

  • narayana
  • sadana
  • dev.tiwari89@gm...
  • naggputta
  • ajaykumar.sana

Total Users

  • 171

Who's online

There are currently 0 users and 0 guests online.