I am getting bulkification issue on "insert at".Not able to understand why there is bulkification issue.Below is my code.

public static Attachment addAttach(Attachment at) {
        try {
            if(at != null) {
                insert at;
            return at;
        catch(DMLException exceptionMessage) {
  • This piece of code is inside a DAO class. – Jack vardy Oct 5 '16 at 19:19

I think, you are calling addAttach() method in a loop which in turn triggering DML (insert) statement.

Best way to handle this, change the parameter Attachment at to List<Attachment> and from the calling method pass the attachments as list and perform the DML in addAttach() on that list.

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.