I have a scenario - which I have no doubt that others will have come a crossed and some will have implemented. The scenario is: to have a web form (created via the Webform module - which has CiviCRM fields integrated into it - via the Webform integration module) that has the CiviCRM fields such as:
- the first name,
- the last name,
- the e-mail address, and
- the address (e.g. address line 1, address line 2, city, post code) etc
and when the user (whom is not logged in - as they do not have a Drupal account) selects submit
- The details entered are saved in CiviCRM, but equally
- A Drupal user is created for the user (no doubt using the Rules module in Drupal).
The issue is that
I’d only want the rule fired if the web form was used, not if I create users via the CiviCRM admin interface (as I have sub-type contacts which wouldn’t need Drupal accounts assigned to them)
When I go into Rules - I can find the triggering event, which i assume would be “CiviCRM Contact: Contact has been created” e.g. when a Contact is created the rule will begin to fire…
what I’m not sure about is:
2a. how to configure the condition for the rule to say “only do the action if the contact is of sub-type x” or if triggered by webform x
2b. how to configure the action portion of the rule to create a new Drupal user
2)b)i. there is the “Create a new entity” option under the Entities section in the drop down for action to add, where i can choose “User” as the value …
Image 2: The rules screen - where trigger specified in top section
Image 3: The options user the actions options
however, on the next screen - where it asks for the login name of the user, the replacement patterns do not provide me with a means of saying use the e-mail entered in the registration form as the User name for the account that I want created; nor does it allow me to specify that the system should pick up the e-mail entered in the web form as use that as the email address for the new account being used.
- side note: I do realise at this point having written the above that the rule was written saying do x when event y is triggered - and without specifying that event y should be coming from webform a, which might explain why the action portion of the rule is not providing any replacement pattern for the username - e.g the rule is generic so would be fired if a contact record was created via a different form or the general CiviCRM admin panel.
So… anyone got any ideas on how to achieve what I’m trying to do above? I assume I can do the above without having to get involved with writing bespoke modules or using hooks etc.