• Pranika Jindal
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I had a trigger that fired from webhook, this trigger receive JSON that contain external Id for account object, inside the trigger I do an upsert on account object using the following code
Database.upsert(accountrecord, external_id__c)


but sometimes for unknown reason I got the following exception
System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: External_Id__c duplicates value on record with id: 0011x00000Gc4LI: []


I tried to add SOQL query to retrieve the account record with the external Id I have to testing purpose and I didn't get any records!
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OrderTrigger: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Class.StatusUpdate.Progress: line 25, column 1
Class.OrderTriggerHandler.afterUpdate: line 57, column 1
Class.TriggerHandler.run: line 47, column 1
Trigger.OrderTrigger: line 91, column 1: []


I am getting this error for my test class fail.