 

 [    ](https://www.facebook.com/sharer/sharer.php?u=https://www.skvare.com/markdownify/node/42&title=Simple%20Rule%20Example%20Using%20CiviCRM%20Entity "Share to Facebook") [    ](https://www.linkedin.com/sharing/share-offsite/?url=https://www.skvare.com/markdownify/node/42 "Share to Linkedin") [    ](mailto:?subject=Simple%20Rule%20Example%20Using%20CiviCRM%20Entity&body=https://www.skvare.com/markdownify/node/42 "Share to Email") 

 

 

#  Simple Rule Example Using CiviCRM Entity 

 CiviCRM CiviCRM Entity Drupal 

 

 

 T

he new Drupal module CiviCRM Entity exposes 11 CiviCRM objects as Drupal Entities and provides rules support for these entities. In this article I will demonstrate how to create a simple rule, which creates a synced Drupal user for the contact when the contact gets a membership.

This how-to assumes you have the[ Rules](https://drupal.org/project/rules) module and the[ CiviCRM Entity](https://drupal.org/sandbox/eileen/1923028) module installed.

**Create the rule:**

- admin/config/workflow/rules/reaction/add
- For name enter "Create Synced User When Contact Gets Membership"
- For **React on Event:** Select "CiviCRM Membership has been created"
- Click **Save**
- Under **Actions** select "Create Linked Drupal User Account"
- Click **Continue**.
- The default value for the CiviCRM contact **Contact Data selector** field should already be correct,but ensure it is: "civicrm-membership:contact-id-contact".
- Check **Activate account** and **Send account notification email** if you wish.
- Click **Save**.

**You can extend the rule**

If you would like to only create the user for a specific membership type.

- Under **Conditions** click the **Add Condition** link
- For the **Select the *condition* to add** field select Data Comparison
- Under **Data to Compare** use the data selector find the membership type id field of the membership object. It should be this: "civicrm-membership:membership-type-id".
- Click **Continue**
- Under **Operator** select **Equals**
- Under **Data Value** enter the membership type id of the membership type you'd like to create linked Drupal users for.
- click **Save**

 

 

- [CiviCRM](/tags/civicrm)
- [CiviCRM Entity](/tags/civicrm-entity)
- [Drupal](/tags/drupal)