I have one Object for which we are doing bulk data update from Mulesoft, there is nothing which we are doing in salesforce for the same. Now due to some validation, few records are getting failed. I need to handle those failed record and update one custom field Failed_Record_Reason__c with some value like 'Validation Failed'

I'm trying to do the same using trigger, but not sure how I'll get the failed record with the reason for their failure. As I'm not doing any DML operation in trigger

  • 2
    Are you using validation rules for validation or your trigger is validating incoming records?? – Mr.Frodo Jun 13 '18 at 7:25
  • I'm using validation rules for validation, nothing in trigger – salesforce Developer Jun 13 '18 at 16:44

Errors that are caused by validation rules can't be caught in a trigger, since it's an API call. You would need to configure something within Mulesoft to do this, assuming it has the capability to do so.

| improve this answer | |
  • I believe the same applies when we do update using data loader – salesforce Developer Jun 13 '18 at 16:45
  • @salesforceDeveloper Correct, any API call, regardless of source, needs to log the errors if you want to get the data. The Data Loader provides an "errorXXXXX.csv" that includes those errors, which you could actually use to log those errors into a separate object. – sfdcfox Jun 13 '18 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.