• oiuzikov
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hello.

 

I have a trigger which, on Task insert/update, iterates over all Tasks for a given Contact, determines which are Phone calls, finds the most recent one, and sets the activity date of that Task on the Contact.  Easy.

 

Then the client enabled the functionality that allows them to relate multiple Contacts with a Task.  So i updated the Trigger to incorporate the TaskRelation object.  But i'm seeing some odd behavior. 

 

On the New Task screen, I associate two Contacts and save.  The first thing my trigger does is query the TaskRelation table for that Task - but the debug log only shows one result.  If i query the table manually (same query via eclipse or whatever), i see two results.  I'm guessing this is a result of my trigger running before the other TaskRelation record is created?  Has anyone else seen this?  As far as i know, my options are limited - i can make it a @future call or a batch process...Anything else?

 

Thanks

Chris