I want to copy the values of the field collections from entityform to node form, using the Rules module.
I tried to loop my field collection, then set value of the field collection from entityform to entitycreated, but this didn't work. I only get blank fields but the number of field collections are the same.
For example I have 5 field collection items per field collection and 5 field collections from entityform, after executing the rule I also have 5 empty field collections on the entitycreated.
Here's a sample of the rule:
{ "rules_after_submitting_entityform_custom_package" : {
"LABEL" : "After submitting entityform Custom package",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "entityform" ],
"ON" : { "entityform_update" : [] },
"IF" : [
{ "data_is" : { "data" : [ "entityform:type" ], "value" : "custom_package_entity_form" } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "sample",
"param_title" : "Your Event",
"param_author" : [ "site:current-user" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "LOOP" : {
"USING" : { "list" : [ "entityform:field-option-criteria" ] },
"ITEM" : { "list_entity_form_option_criteria" : "Current list item" },
"DO" : [
{ "data_set" : {
"data" : [ "entity-created:field-option-criteria" ],
"value" : [ "entityform:field-option-criteria" ]
}
}
]
}
},
{ "data_set" : {
"data" : [ "entity-created:field-entityform-referenced" ],
"value" : [ "entityform" ]
}
},
{ "entity_save" : { "data" : [ "entity-created" ] } },
{ "redirect" : { "url" : "[entity-created:url]", "destination" : "1" } }
] }}
Any idea, how to set this the right way?
Also, after creating this rule, I get this error when trying to delete the node created:
Fatal error: Call to a member function delete() on a non-object in /sites/all/modules/field_collection/field_collection.module on line 830
I also tried using the Entity reference autofill module but it's not auto-filling the fields if I try it with Rules.
Any suggestions?