2

I am trying to follow the procedure outlined in How can I create a Drupal user when someone submits a CiviCRM-Webform?... but when I try to add the Event to the Rule described, 'CiviCRM Entity Tag' does not appear in the list of possible triggers. I must be missing some module or configuration option, but can't see it. Any help welcome, Thanks, Tony

1 Answer 1

1

Try this:

{ "rules_self_create_user_account_and_login" : {
"LABEL" : "Create User Account",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "civicrm", "rules" ],
"ON" : { "civicrm_entity_tag_create" : [] },
"IF" : [
  { "NOT civicrm_entity_user_exists" : { "civicrm_contact" : [ "civicrm-entity-tag:entity-id-contact" ] } },
  { "data_is" : {
      "data" : [ "civicrm-entity-tag:entity-table" ],
      "value" : "civicrm_contact"
    }
  },
  { "data_is" : { "data" : [ "civicrm-entity-tag:tag-id" ], "value" : "XXXX" } }
],
"DO" : [
  { "civicrm_entity_action_create_user" : {
      "USING" : {
        "civicrm_contact" : [ "civicrm-entity-tag:entity-id-contact" ],
        "is_active" : "1",
        "notify" : "1",
        "signin" : "1",
        "username_format" : "email"
      },
      "PROVIDE" : { "civicrm_user" : { "civicrm_user" : "Created Drupal User" } }
    }
  },
  { "redirect" : { "url" : "civicrm\/user?reset=1" } }
]

} }

set XXX to be your Tag ID

EDIT (thx to jackrabbithanna) Make sure Entity Tag is enabled here: admin/structure/civicrm-entity/settings

7
  • Thank you, I have tried this, and I get the error message:
    – user6274
    Jul 24, 2018 at 14:20
  • Sorry - finger trouble. I have tried this and get the error message: Integrity check for the imported configuration failed. Error message: Data selector <em class="placeholder">civicrm-entity-tag:entity-id-contact</em> for parameter <em class="placeholder">civicrm_contact</em> is invalid.. This seems to tally with the fact that CiviCRM Entity Tag does not appear in the list of options when I try to create it through the UI. Regards, Tony
    – user6274
    Jul 24, 2018 at 14:20
  • 1
    I seem to confused myself by asking this question in two places, so to summarise: <br> I am on Drupal 7.59, CiviCRM 7.x-5.3.0, CiviCRM Entity 7.x-2.1, Rules 7.x-2.11. <br> I have been through Laryn's procedure to step 5, when I get the drop-down he shows, but the sections headed 'CiviCRM Entity Tag' are missing. I do see 'CiviCRM Entity Event' plus others, so it looks as if CiviCRM Entity is doing something. <br> Thanks, Tony
    – user6274
    Jul 25, 2018 at 14:39
  • 1
    Yes, CiviCRM Entity Actions is enabled. Tony
    – user6274
    Jul 26, 2018 at 7:42
  • 1
    I am able to import the Rule on my CE dev local....Make sure Entity Tag is enabled here: admin/structure/civicrm-entity/settings , also might try v2.2 of CiviCRM Entity Dec 21, 2018 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.