Events#
CRM ECA registers derived ECA events under plugin ID crm (for example
crm:user_mapped). Use them as the start of an ECA model.
Entity insert, update, and delete for CRM entity types remain eca_content events. The events below cover mapping lifecycle, primary method changes, and a relationship becoming inactive.
Event plugins#
| ECA plugin | Label | Event name | When |
|---|---|---|---|
crm:mapping_requested |
User-contact mapping requested | CRM UserContactMappingEvent |
Before the mapping is saved, inside CRM ensureContactForUser(). Entity insert is too late for this step. |
crm:user_mapped |
User mapped to contact | crm_eca.user_mapped |
After a crm_user_contact_mapping entity is inserted. |
crm:user_unmapped |
User unmapped from contact | crm_eca.user_unmapped |
After a mapping entity is deleted. |
crm:method_primary_changed |
Contact method primary changed | crm_eca.method_primary_changed |
After a contact update where the primary email, telephone, or address changed. |
crm:relationship_inactive |
Relationship became inactive | crm_eca.relationship_inactive |
After a relationship update that leaves an active relationship inactive. |
crm:user_mapped, crm:user_unmapped, crm:method_primary_changed, and
crm:relationship_inactive are dispatched from entity hooks in this
module.
Mapping requested#
Fires on an unsaved mapping while CRM is ensuring a contact for a user. Use this when later insert events are too late (for example to alter lookup or create behavior).
Available tokens: [crm_user_contact_mapping], [crm_contact],
[crm_mapped_user], [crm_primary_email], [crm_primary_telephone].
User mapped / unmapped#
Fired after the mapping entity is inserted or deleted. The mapping
entity is still available as [crm_user_contact_mapping] on unmap
(the entity being deleted).
Available tokens: [crm_user_contact_mapping], [crm_contact],
[crm_mapped_user], [crm_primary_email], [crm_primary_telephone].
Contact method primary changed#
Dispatched when the primary item on emails, telephones, or
addresses changes. If the previous primary is cleared and a new one
is set, two events fire: operation removed, then added.
The event entity is the contact. [crm_contact_method] is the method
that became or stopped being primary.
Available tokens: [crm_contact], [crm_contact_method],
[crm_primary_email], [crm_primary_telephone]. Mapping tokens are
not set unless a mapping is on the event (these events do not carry
one).
Relationship became inactive#
A relationship is treated as active when it is published (status)
and end_date is empty. The event fires when an update changes an
active relationship to inactive (unpublished or end_date set).
Available tokens: [crm_relationship]. Contact and mapping tokens are
not set from this event.
See Tokens for token details.