The desired outcome was to create a drupal user record if and only if an email exists on the contact - when a membership was created/updated.
To do this I wanted to add the condition "CiviCRM Contact has Email".
Testing this on multiple sites I've come to the conclusion that it doesn't appear to be working as advertised - it's not returning true when the associated contact has an email.
I've tested using these two stripped down rules - (It's not working on civicrm contact is updated either) - pasted below.
The only think I can think off that could be causing this is that the data selector is not correct? I tested this by outputting this using the debug action but perhaps it needs an ID not a "contact" or vice versa? I can't see any errors in the drupal log that would indicate this though. The rule is returning successfully - it's not generating any warnings.
Membership update
{ "rules_test_2" : {
"LABEL" : "Test 2",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "civicrm", "rules", "devel" ],
"ON" : { "civicrm_membership_edit" : [] },
"IF" : [
{ "civicrm_entity_contact_hasemail" : {
"contact" : [ "civicrm-membership:contact-id-contact" ],
"location" : "0"
}
}
],
"DO" : [
{ "drupal_message" : { "message" : "Has email" } },
{ "devel_debug" : { "value" : [ "civicrm-membership:contact-id-contact" ] } }
]
}
}
Contact update
{ "rules_test" : {
"LABEL" : "Test",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "civicrm", "rules" ],
"ON" : { "civicrm_contact_edit" : [] },
"IF" : [
{ "civicrm_entity_contact_hasemail" : { "contact" : [ "civicrm-contact" ], "location" : "0" } }
],
"DO" : [ { "drupal_message" : { "message" : "Has emali" } } ]
}
}