I've been going crazy trying to figure this out. I think I am close, but seem to be missing something with the rule actions. Any help would be most appreciated.
Background:
I’m trying to create nodes from webforms that will pull in certain fields from the webform, namely, first and last names (text fields), affiliation (from an entity filed), and conference to attend (check box list). The reason for this node content type is to pull the conference registrants names and affiliations into a view that will list on each conference page. The content type for the attendees is called “Conference Participants.” The reason for doing this is so the staff in my department does not have to manually enter each person who register.
Present Status:
I started using this process last year with minor success. That is, I was able to use Rules to take a submitted webform and create a node with the participants last, first name as the title. I set the content type to not publish so either I or the staff members could verify the information and publish. As it now stands, the workflow is:
- Events - Event: After a webform has been submitted
- Conditions – Elements: Webform has a name – Parameter: The form id of the submitted form: [form-id: value, Webforms: Summer Conference
- Actions – Elements:
- Create a new entity – Parameter: Entity type: Node, Content type: Conference Participants, Title: [data:last_name-value], ..., Author: [node:author] Provides variables: Created entity (entity_created)
Issues:
I have not been able to pull any of the text fields (first and last name) from the webform into the node. For my testing, I’ve created a new “email” text field in the node because it is a standard field with most forms. There is a check box list of conference names in which more than one can be checked. I also have an entity type filed (auto complete) of universities around the world which are not pulling in. I suspect this one may be a bit more complicated since it is an entity type field and I may need to use another type of action, e.g. loop. I should add that there are other fields in the content type (Conference Year and a text box for participants to manually type in an institution that is not listed in the entity filed). I have the conference year checked automatically for 2018 (see screen shot below).
Drupal and Module Background:
- Drupal 7
- Rules Module
- Webform Rules
- Conditional Rules
What I’ve tested:
• Conditionals
- NOT an authenticated user
- Entity has field
- Set a data value
- Add a variable (with webform tokens using raw and just the value)
Posts I’ve looked at:
How to do a data comparison to submitted webform data when using the Rules module?
How do you make entity fields appear in Rules when converting a Webform submission to node?
How to implement a multi step approval with webforms/entityforms based on form components?
Screen shots
Summer Conference Participant Rule workflow
Conditions: Elements: Webform has name
Actions: Elements: Create a new entity
Actions: Elements: Add a variable
Actions: Elements: Save Entity
Rule Export
{ "rules_summer_conference_participants" : {
"LABEL" : "Summer Conference Participants",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "webform_rules", "rules", "rules_conditional" ],
"ON" : { "webform_rules_submit" : [] },
"IF" : [
{ "webform_has_id" : {
"form_id" : [ "form-id" ],
"selected_webform" : { "value" : { "webform-client-form-86866" : "webform-client-form-86866" } }
}
}
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "conference_participants",
"param_title" : "[data:last_name-value], [data:first_name-value]",
"param_author" : [ "node:author" ]
},
"PROVIDE" : { "entity_created" : { "conference_participant_webform" : "Conference Participant Webform" } }
}
},
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_email" } },
"DO" : [
{ "variable_add" : {
"USING" : { "type" : "text", "value" : "[data:email-value]" },
"PROVIDE" : { "variable_added" : { "field_email" : "email" } }
}
}
]
}
]
},
{ "entity_save" : { "data" : [ "node" ], "immediate" : "1" } }
] }}
Debug Info
Rules debug information:
" Reacting on event After a webform has been submitted.
- 0 ms Reacting on event After a webform has been submitted.
- 10.813 ms Evaluating conditions of rule Summer Conference Participants.
- 11.057 ms The condition webform_has_id evaluated to TRUE
- 11.067 ms AND evaluated to TRUE.
- "Rule Summer Conference Participants fires.
- 0 ms Rule Summer Conference Participants fires.
- 28.914 ms Evaluating the action entity_create.
- 29.263 ms Added the provided variable conference_participant_webform of type node
- 31.59 ms Evaluating the action variable_add.
- 31.649 ms Added the provided variable field_email of type text
- 31.747 ms Evaluating the action entity_save.
- 31.8 ms Saved node of type node.
- 727.681 ms Rule Summer Conference Participants has fired.
- 738.827 ms Evaluating conditions of rule Conference Participant.
- 741.628 ms The condition webform_has_id evaluated to FALSE
- 741.639 ms AND evaluated to FALSE.
- 741.68 ms Saved conference_participant_webform of type node.
- 861.009 ms Finished reacting on event After a webform has been submitted.