database.update salesforce sr.getid null
List<Account> accountsList = [select Id from Account];
for(Account a : accountsList) {
a.Name = 'Test',
}
List<Database.SaveResult> res = Database.update(accountsList, false);
//for (Database.SaveResult s : res) { //replaced by the following line
for (Integer i = 0; i < accountsList.size(); i++) {
Database.SaveResult s = res[i];
Account origRecord = accountsList[i];
if (!s.isSuccess()) {
system.debug(s.getId()); // I get null here
system.debug(origRecord.Id); //This should be the Id you're looking for
}
}