Question

I'm using Webforms (via the Webform module) and using Rules (with the Rules module and the Webform Rules module)... as a side note, I'm also using CiviCRM although I don't think that is has an impact of the issue I am having...

When using Rules I can specify an action to take place on a given event - in my case when a particular webform is submitted. When webform 'a' is submitted I want a Drupal user to be created...

If I use the action 'create entity' and specify that the entity to be created is of type 'User' then if I statically enter the value for the username and the e-mail address the Drupal account is created.

However, if I try to tell the action creation process to use the value entered in the webform as the username and the e-mail address ( e.g. [data:{component}-value] where {component} is substituted for the machine name of the field in question ) for the intended Drupal account, no Drupal account is created. Does anyone know why this is the case and what the solution for this is?

Side note: I know the value used in [data:{component}-value] is correct as I added an action saying output a message and added the data field to the message and it shows the correct details (e.g those entered in the webform)

Was it helpful?

Solution

You can use a technique similar to what is described in my answer to "How to do a data comparison to submitted webform data when using the Rules module?". For short:

  • Add an extra Rules Action to Add a variable, with a value assigned to it equal to your [data:ComponentFieldName-value-raw] (and with a data type which equals the data type of your Webform component). Looks like you need 2 variables though: 1 for the username, one for the eMail ID.
  • In your subsequent Rules Actions you can refer to the value of these variables you just added (that's the clue!).
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top