I am getting Error While Performing Database.Upsert[] result in Salesforce and Want to get record Ids of Failure records. I am getting Null When Using the Below Code. Database.UpsertResult[] srList =...


Professor please do not reject it under complex . I want answer and if you have not the anser please let someone other help me. if this behaviour is repeated agan it will be reported to the administration. I have reported the behaviour to concerned authority feel free to be unemployed n few days.


I am getting Error While Performing Database.Upsert[] result in Salesforce<br>and Want to get record Ids of Failure records.<br>I am getting Null When Using the Below Code.<br>Database.UpsertResult[] srList = Database.upsert(listOfAccounts ToUpdate, false);<br>mapOfAccounts.putAll(listOfAccountsToUpdate);<br>System.debug('map log again' + mapOfAccounts);<br>// Iterate through each returned result<br>for (Database.UpsertResult sr : srList) {<br>System.debug('sr.getID()'+sr.getld());<br>if (sr.isSuccess()) {<br>listOfErrorLogUpsert.add(new Error_Log_c(Parent_Record_Idc = sr.getld(),Parent Record_Name_c = mapOfAccounts.ContainsKey(sr.getld()) ? mapOfAccounts.get(sr.getld()).Name:

Extracted text: I am getting Error While Performing Database.Upsert[] result in Salesforce and Want to get record Ids of Failure records. I am getting Null When Using the Below Code. Database.UpsertResult[] srList = Database.upsert(listOfAccounts ToUpdate, false); mapOfAccounts.putAll(listOfAccountsToUpdate); System.debug('map log again' + mapOfAccounts); // Iterate through each returned result for (Database.UpsertResult sr : srList) { System.debug('sr.getID()'+sr.getld()); if (sr.isSuccess()) { listOfErrorLogUpsert.add(new Error_Log_c(Parent_Record_Idc = sr.getld(),Parent Record_Name_c = mapOfAccounts.ContainsKey(sr.getld()) ? mapOfAccounts.get(sr.getld()).Name: ")); // Operation was successful, so get the ID and insert contact on that id's for(Integer j =1; j<=listofcontacts.size(); j++){ listoofcontacttolnsert.add(new contact(firstname = 'sammer' +j, lastname = 'test'+ j, accountld = sr.getld())); } system.debug('succesfully updated the account' + sr.getld()); } else { // operation failed, so get all errors for(database.error err : sr.geterrors()) { listoferrorlogupsert.add(new error_log_c(error_detailsc = err.getmessage(),parent record_ld_c sr.getld())); system.debug('the following error has occurred.'); system.debug(err.getstatuscode() + ': ' + err.getmessage()); system.debug('account fields that affected this error: '+ err.getfields()); } } please update the below code so that i can get the record ids of failure records. apex salesforce j++){="" listoofcontacttolnsert.add(new="" contact(firstname='Sammer' +j,="" lastname='Test' +="" j,="" accountld="sr.getld()));" }="" system.debug('succesfully="" updated="" the="" account'="" +="" sr.getld());="" }="" else="" {="" operation="" failed,="" so="" get="" all="" errors="" for(database.error="" err="" :="" sr.geterrors())="" {="" listoferrorlogupsert.add(new="" error_log_c(error_detailsc="err.getMessage(),Parent" record_ld_c="" sr.getld()));="" system.debug('the="" following="" error="" has="" occurred.');="" system.debug(err.getstatuscode()="" +="" ':="" '="" +="" err.getmessage());="" system.debug('account="" fields="" that="" affected="" this="" error:="" '+="" err.getfields());="" }="" }="" please="" update="" the="" below="" code="" so="" that="" i="" can="" get="" the="" record="" ids="" of="" failure="" records.="" apex="">
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here