0

Here is my rule export. "Cannot create user, email: invalid!!" error occurs soon after submitting the webform. Drupal user has to be created soon after Civicrm contact is created. After submitting webform as I have used civicrm integration, civicrm contact is created. Any help??

{ "rules_create_drupal_user" : {
  "LABEL" : "Create Drupal User",
  "PLUGIN" : "reaction rule",
  "OWNER" : "rules",
  "REQUIRES" : [ "civicrm" ],
  "ON" : { "civicrm_contact_edit" : [], "civicrm_contact_create" : [] },
  "IF" : [
    { "NOT civicrm_entity_user_exists" : { "civicrm_contact" : [ "civicrm_contact" ] } }
  ],
  "DO" : [
    { "civicrm_entity_action_create_user" : {
        "USING" : {
          "civicrm_contact" : [ "civicrm_contact" ],
          "is_active" : "1",
          "notify" : "0",
          "signin" : "0",
          "username_format" : "first last"
        },
        "PROVIDE" : { "civicrm_user" : { "civicrm_user" : "Created Drupal User" } }
      }
    }
  ]
}
}
0

Here is a rule that fires when civicrm contact is created. It works off Tag, ie the webform adds a Tag to the Contact. Rules then runs off that event. Note this rule also auto logs the person in but you should be able to get some clues from this. You need civicrm_entity module.

    { "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" : "525" } }
    ],
    "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" } }
    ]
  }
}
| improve this answer | |

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.