2

I have a need where i need to update a field in account with the latest activity date. I can write triggers on events and task but when there is a email activity which is logged in as activity i need to update this email activity date into account

I know there is a field on account called last activity date which stores the last activity date but my need is to filter out the activities which have a particular subject line and update the last activity date with a particular subject

Any ideas or thoughts to achieve this?

  • 1
    What kind of email activity are you looking for? Normally an email will be created as a Task. – Jeremy Nottingham Mar 24 '13 at 1:07
  • Thanks.. was not aware that emails are created as tasks – Prady Mar 27 '13 at 2:33
1

I think the answer to your question is going to depend on whether your workflow automatically updates the Account's LastActivityDate Asynchronously whenever the Account History object shows a change. Its possible it may be done as a batch operation as opposed to an asynchronous one. I honestly don't know how its typically done, but am trying to take a stab at providing some timely assistance.

If the account is updated asyncronously, you'd need the trigger to be one that fires "on update" of the Account's LastActivityDate. You'd then want to query the Account History for the fields that contain the objects you're looking for the activities which would have the subject lines you're wanting to filter on.

If workflow doesn't update the Account asyncronously, then you'd need to make the trigger fire "on update" of the Account History object, query Account History for the subject lines you're looking for, then update the LastActivityDate in the Account. You'd also want to look at how any batch programs update that field which might affect how your trigger operates, or more accurately, what the trigger accomplishes for your organization.

Hope this helps you get started. :)

|improve this answer|||||

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.