I am trying to fetch the contact entity in a rule which triggers when a specific tag is added to that contact. I seem to be able to load and fetch the Drupal user for the contact but not the actual contact entity itself.
Is there a way for me to fetch the contact entity when a certain tag is added?
I want to fetch the contact entity so I can then delete it, using entity delete action in rules.
Ultimately I am using Webform for this which will add the tag which triggers the rule.
I know this sounds a bit dangerous but I hope to put some safeguards in place to prevent anyone with access to the webform deleting any contacts!
EDIT to Clarify:
I am trying to build the ability to delete a contact in CiviCRM using a webform in Drupal.
The way I wanted to do it, was that a CiviCRM contact with a Drupal user account logs into Drupal where they can see a list of all employees for the same organisation that they are employed by (I have done this part). I then want to give the logged in contact the ability to delete other employees of the organisation that they can see listed.
I have already managed to give logged in users the ability to create new contacts for their organisation with an option to create a Drupal account for the new contact as well.
I added the ability for logged in users to create new contacts, as well as a Drupal account, by following the very clear and helpful steps given in How can I create a Drupal user when someone submits a CiviCRM-Webform?
This method above, involved adding a tag to a contact which then triggers the add Drupal account rule. I was thinking to use the same method of adding a tag to a contact to trigger the delete contact rule. however, I can't seem to fetch the contact as an entity within the rule in order to delete the entity.
I am using Drupal 7.58 with CiviCRM 4.7.28.