I'll make this as simple as possible. I have a trigger on the contact object. It is to fire after insert or after update. If it's an insert operation I need to send a callout message saying essentially 'Contact created'. If it's an update operation I need to send a callout message saying 'Contact updated'. The problem is that there is a managed package installed that also has trigger on the contact object and it fires first. If the user creates a new contact record, the managed package trigger sets a field and then performs a DML update on the new record. What happens next is this fires my trigger as an 'AFTER UPDATE', then later as an 'AFTER INSERT'.
Why? How does my trigger know when first called(AFTER UPDATE) that this is actually an INSERT of a record?
Here's the edited debug log:
14:31:13.165 (429325994)|ENTERING_MANAGED_PKG|integrator_da 14:31:13.165 (429670005)|DML_BEGIN||Op:Update|Type:Contact|Rows:1 14:31:13.616 (616358875)|CODE_UNIT_STARTED|[EXTERNAL]|01q4C0000000JrB|Contacts on Contact trigger event AfterUpdate|__sfdc_trigger/Contacts 14:31:13.647 (647778607)|CODE_UNIT_STARTED|[EXTERNAL]|01q4C0000000JrB|Contacts on Contact trigger event AfterInsert|__sfdc_trigger/Contacts