I am trying to delete a record using the recordID:

final Boolean doNotAllowPartialSuccess = true;

database.delete(recordId, doNotAllowPartialSuccess);

I am getting this error:

DML statement found null SObject at position 0

It's being deleted by a Customer Community Login User who has READ, CREATE, EDIT and DELETE permissions on the object.

I know the record exists.


  1. What am I doing wrong?
  2. How can I fix it?
  • 1
    Could you share more of your code? It seems like your recordId variable may be null. – Bartosz Śliwiński May 24 at 11:24
  • @BartoszŚliwiński you were right! thank you – Robs May 24 at 11:25
  • Sure, thanks ;) – Bartosz Śliwiński May 24 at 12:05

Seems like your recordId variable is null. Check if you actually populate that.

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.