Hi there,

Deleting a contact in the CiviCRM UI does not actually delete the entity. It simply just sets a flag, "is_deleted", to 1. The only time the entity should be completely removed is when the contact is purged from the trash.

When the contact is initially moved to the trash, this should fire an update event - because that flag has changed.

When the contact is purged from the trash, this is when the rules delete event should fire.

We could argue that the rules event placement is sufficient due to the context of the action occurring in CiviCRM. But I'd disagree seeing as what should actually be happening within the entity is an update event, strictly speaking.

This issue is causing drama with a real time integration project I'm running.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

strainyy’s picture

After some digging, I can see now that this is actually a CiviCRM Core issue, trash and delete operations are fired concurrently when implementing hook_civicrm_post. I've created a new issue to try to address this on the CiviCRM-side, open to work-arounds however.

https://issues.civicrm.org/jira/browse/CRM-15868

strainyy’s picture

strainyy’s picture

Status: Active » Needs review

  • b859d98 committed on 7.x-2.x
    #2413469 treat delete to trash as an update in rules
    
eileenmcnaughton’s picture

Status: Needs review » Fixed

OK - I'm accepting this & committing it - although looks like I should have used the commit message below to get the attribution right (sorry).

I have some misgivings about the effect on existing sites - but this is going out in the 2.x (which we should take out of dev soon) so I guess that mitigates that somewhat.

Note sure where this would be best documented

eileenmcnaughton’s picture

I added a note on the main project page under 'upgrade notes'

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.