Last updated December 9, 2012. Created by mitchell on May 21, 2012.
Log in to edit this page.
You can use this action to:
* create a user
* create a node
* ...
Creating Multiple Entities
To create multiple entities, use the 'Save entity' action after the 'Create a new entity' action.
Below is an example component rule which illustrates this. When executed, it asks for a list of titles from which to create a group of pages.
{ "rules_list_create" : {
"LABEL" : "List create",
"PLUGIN" : "rule",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "titles" : { "label" : "Titles", "type" : "list\u003Ctext\u003E" } },
"DO" : [
{ "LOOP" : {
"USING" : { "list" : [ "titles" ] },
"ITEM" : { "list_item" : "Current list item" },
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "page",
"param_title" : [ "list-item" ],
"param_author" : [ "site:current-user" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } }
]
}
}
]
}
}