locked
Which is the best way to count email attachments? RRS feed

  • Question

  • I would like to add an attribute to the email entity that should keep the number of attachments related to that email.

    I've been thinking on a plug-in that will trigger on the update event of email, count the related activitymimeattachments with a RetrieveMultiple, and then update the email attachmentCount attribute.

    However, I am a little sceptical to use an update within the "update"-plugin because of the possibility of endless loops..

    Is there another approach that I should use?

    -Stian-
    Friday, March 6, 2009 11:07 AM

Answers

  •  

    Hi,

    I will suggest you to go for plug-in for create event of the note (annotation) entity. In it, check if this note is related to email and it got attachment, if there it is then update the total number of attachments in the new field on the email entity.


    MS CRM MVP :: uMar Khan :: MS CRM Consultant (Blog :: http://umarkhan.wordpress.com)
    Friday, March 6, 2009 11:38 AM
    Moderator

All replies

  •  

    Hi,

    I will suggest you to go for plug-in for create event of the note (annotation) entity. In it, check if this note is related to email and it got attachment, if there it is then update the total number of attachments in the new field on the email entity.


    MS CRM MVP :: uMar Khan :: MS CRM Consultant (Blog :: http://umarkhan.wordpress.com)
    Friday, March 6, 2009 11:38 AM
    Moderator
  •  I would back up the use of create event on notes.

    Just remember to check for update and delete if an attachment was added or removed after create.
    Saturday, March 7, 2009 12:12 AM