function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chris_centrachris_centra 

TaskRelation timing question...

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

oiuzikovoiuzikov

I'm seeing the same odd behavior. However EventRelations works fine and are available in after Event update trigger

develodevelo

Any answer to this issue?

tilottamatilottama
Hi I am exactly into the same issue. Please help me out on this. chris did you find any solution to it ?
chris_centrachris_centra

i'm afraid i never found a suitable answer.  i moved the code into a scheduled batch process.

best of luck to you

chris