Answers.Body: <p>There are a few things you can try here:</p>
  <ul>
  <li>Go to CiviCRM's <strong>Administer menu &gt;&gt; System Settings &gt;&gt; CMS Database Integration</strong>.  Compare the array there against the one listed in <code>settings.php</code>.  This array (in <code>settings.php</code>) must be updated when you add new custom field groups to CiviCRM (since they add new tables).  This is most likely your issue.</li>
  <li>Consider installing the <code>civicrm_entity</code> module, which should make your CiviCRM entities available as Drupal entities.</li>
  <li>Consider using CiviRules, which is a CiviCRM-native rules engine.  It's very similar to Rules, but it generally understands CiviCRM better.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-17T12:40:53.417Z
Answers.LastActivityDate: 2020-11-17T12:40:53.417Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I'm trying to access a custom field used for <strong>Membership</strong> in CiviCRM from the <strong>Drupal</strong> <strong>Rules</strong> module.
  But it seems this custom field, <em><strong>civicrm-membership:custom-8</strong></em>, in not accessible from the Drupal Rules modules and it doesn't contain any value.</p>
  <p>This is the rule I'm trying to create to <strong>add a CiviCRM Contact to a Group</strong>:</p>
  <p>{ &quot;rules_add_group_to_contacts&quot; : {<br />
  &quot;LABEL&quot; : &quot;Add Contacts to Groups&quot;,<br />
  &quot;PLUGIN&quot; : &quot;reaction rule&quot;,<br />
  &quot;WEIGHT&quot; : &quot;1&quot;,<br />
  &quot;OWNER&quot; : &quot;rules&quot;,<br />
  &quot;REQUIRES&quot; : [ &quot;devel&quot;, &quot;rules_conditional&quot;, &quot;civicrm_entity&quot;, &quot;rules&quot;, &quot;civicrm&quot; ],<br />
  &quot;ON&quot; : { &quot;<strong>civicrm_membership_create</strong>&quot; : [] },<br />
  &quot;DO&quot; : [<br />
  { &quot;devel_debug&quot; : { &quot;value&quot; : [ &quot;<em><strong>civicrm-membership:custom-8</strong></em>&quot; ] } },<br />
  { &quot;CONDITIONAL&quot; : [<br />
  {
  &quot;IF&quot; : { &quot;text_matches&quot; : {<br />
  &quot;text&quot; : [ &quot;<em><strong>civicrm-membership:custom-8</strong></em>&quot; ],<br />
  &quot;match&quot; : &quot;Stay and Play - Coffee mornings&quot;<br />
  }<br />
  },<br />
  &quot;DO&quot; : [<br />
  { &quot;civicrm_entity_rules_action_assign_contact_to_group&quot; : {<br />
  &quot;contact&quot; : [ &quot;civicrm-membership:contact-id-contact&quot; ],<br />
  &quot;group_id&quot; : { &quot;value&quot; : { &quot;18&quot; : &quot;18&quot; } }<br />
  }<br />
  }<br />
  ]</p>
  <p>I'm working with <strong>Drupal 7</strong>.</p>
  <p>Many thanks in advance for your help.</p>
  
Tags: <civimember><drupal-7><rules>
Title: Custom Field for CiviCRM Membership not accessible from Drupal Rules module
ThreadText: # Custom Field for CiviCRM Membership not accessible from Drupal Rules module
  
  (Asked by: username_0 on 2020-11-17)
  
  I'm trying to access a custom field used for **Membership** in CiviCRM from the **Drupal** **Rules** module.
  But it seems this custom field, ***civicrm-membership:custom-8***, in not accessible from the Drupal Rules modules and it doesn't contain any value.
  
  This is the rule I'm trying to create to **add a CiviCRM Contact to a Group**:
  
  { "rules\_add\_group\_to\_contacts" : {  
  "LABEL" : "Add Contacts to Groups",  
  "PLUGIN" : "reaction rule",  
  "WEIGHT" : "1",  
  "OWNER" : "rules",  
  "REQUIRES" : [ "devel", "rules\_conditional", "civicrm\_entity", "rules", "civicrm" ],  
  "ON" : { "**civicrm\_membership\_create**" : [] },  
  "DO" : [  
  { "devel\_debug" : { "value" : [ "***civicrm-membership:custom-8***" ] } },  
  { "CONDITIONAL" : [  
  {
  "IF" : { "text\_matches" : {  
  "text" : [ "***civicrm-membership:custom-8***" ],  
  "match" : "Stay and Play - Coffee mornings"  
  }  
  },  
  "DO" : [  
  { "civicrm\_entity\_rules\_action\_assign\_contact\_to\_group" : {  
  "contact" : [ "civicrm-membership:contact-id-contact" ],  
  "group\_id" : { "value" : { "18" : "18" } }  
  }  
  }  
  ]
  
  I'm working with **Drupal 7**.
  
  Many thanks in advance for your help.
  
  **Tags:** civimember, drupal-7, rules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-17. Score: 1
  
  There are a few things you can try here:
  
  * Go to CiviCRM's **Administer menu >> System Settings >> CMS Database Integration**. Compare the array there against the one listed in `settings.php`. This array (in `settings.php`) must be updated when you add new custom field groups to CiviCRM (since they add new tables). This is most likely your issue.
  * Consider installing the `civicrm_entity` module, which should make your CiviCRM entities available as Drupal entities.
  * Consider using CiviRules, which is a CiviCRM-native rules engine. It's very similar to Rules, but it generally understands CiviCRM better.
  
  
  ---
  
  