0

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.