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
Maf_007Maf_007 

Record on Trigger Context

Hi All,

I have a trigger on Lead
 which insert a record on a custom object (Lead looks up to custom object) which causes a trigger on custom object to fire to relate lead with the custom object. But surprisingly newly created lead does not come up on my soql query (every other matching record is available)? Is there any reason for that or Salesforce has a limitation doing so?

Any help will be appreciated? 
Pundareekam KudikalaPundareekam Kudikala
All these operations performing under single transaction, Update/Insert on Lead trigger is saved to databse but not commited. When Custom Object Triggers fires and looks for lead records which would not find the record which you inserted in this transaction.

If you still have any questions please refer to order of excution of Apex Trggers.