Apex Trigger Practice (3) – Trigger on Attachments to count the number of attachments

Question Hints:

Account is standard object and attachment is child object.

Requirement:

We need to create an Apex Trigger on Attachments to count the number of attachments on the object – let’s take Account – and store in number field “Number of attachments”.

Trigger is considering all the possible scenarios in this – after insert, after update, after delete, after undelete.

Implementation Verification:

Upload your code in Github and provide the link of public repo in comment below, it will be reviewed based on availability and feedback will be shared.

P.S: Be honest, watch the clock to check your efficiency. Happy coding.

73 thoughts on “Apex Trigger Practice (3) – Trigger on Attachments to count the number of attachments”

  1. When someone writes an paragraph he/she retains the thought of a user in his/her brain that how a user can know it.
    Thus that’s why this article is great. Thanks!

  2. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is
    added I get three e-mails with the same comment.
    Is there any way you can remove me from that service? Appreciate it!

  3. Hi, I think your blog might be having browser compatibility issues.
    When I look at your blog in Chrome, it looks fine but
    when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, very good blog!

    my blog :: joker123 online download [918kiss-m.com]

  4. Hello there! I know this is somewhat off topic but I was wondering which blog platform are
    you using for this site? I’m getting sick and tired of WordPress because I’ve had problems with hackers
    and I’m looking at options for another platform. I would be
    fantastic if you could point me in the direction of a good platform.

    My web site … mega888

  5. Hey are using WordPress for your blog platform?
    I’m new to the blog world but I’m trying to get
    started and create my own. Do you require any
    html coding knowledge to make your own blog? Any help would be really appreciated!

  6. fantastic submit, very informative. I’m wondering why the opposite specialists of this sector
    don’t understand this. You should continue your writing. I am
    confident, you have a great readers’ base already!

  7. I used to be recommended this website via my cousin.
    I am no longer positive whether or not this post is written by
    him as nobody else realize such designated approximately my problem.
    You are amazing! Thanks!

  8. Yesterday, while I was at work, my cousin stole my iPad and tested to
    see if it can survive a forty foot drop, just so she can be a youtube sensation. My apple ipad is now
    destroyed and she has 83 views. I know this is
    entirely off topic but I had to share it with someone!

  9. Hi, I do believe this is a great blog. I stumbledupon it 😉 I
    may revisit once again since i have bookmarked it. Money and freedom
    is the greatest way to change, may you be rich and continue to help other
    people. 0mniartist asmr

Comments are closed.