• sowmya chilukuri
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
The two records in the list has validation rule fired, out of which one record has valid data and other has invalid which means validation fired. But the update failed on both showing the validation on both records. Also the batch class has database.saveresult and checked the error message which shows same on the records. does Database.update work on making partial update?
Hi,
Have a quick question on how to pass the list of returned records from method 1 to method 2.


public List<Lead> getCurrentMonthInfo() {
List<Lead> ll=Database.query('SELECT Id,Name,Division_Name__c,Title,counting__c '+ 'FROM Lead');  leadcount = ll.size(); 
return II;
}
Public boolean method 2( //Here I want the record list from Method getCurrentMonthInfo) {
}

Thanks,
 
The two records in the list has validation rule fired, out of which one record has valid data and other has invalid which means validation fired. But the update failed on both showing the validation on both records. Also the batch class has database.saveresult and checked the error message which shows same on the records. does Database.update work on making partial update?
When i try to execute below code snippet, Ideally only my 1st element in the list should get failed as I am trying to set quantity field to 0 and rest of records should get saved to Database successfully. But all the records are getting failed.

List<OpportunityLineItem> lstOLI  = [SELECT Id,Quantity FROM OpportunityLineItem LIMIT 10];
lstOLI[0].Quantity = 0;
List<Database.SaveResult> resultSet = Database.update(lstOLI,false);
system.debug('---resultSet-- '+resultSet);

Output -
USER_DEBUG [4]|DEBUG|---resultSet-- (Database.SaveResult[getErrors=(Database.Error[getFields=(Quantity);getMessage=field integrity exception: Quantity (quantity must be nonzero);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;] 
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;]
, Database.SaveResult[getErrors=(Database.Error[getFields=(unknown);getMessage=field integrity exception: unknown (total price must be specified);getStatusCode=FIELD_INTEGRITY_EXCEPTION;]);getId=null;isSuccess=false;])
  • October 18, 2016
  • Like
  • 0