Have a look at the exported rule below, which is a variation of the (exported) rule in your question:
{ "rules_create_1st_group_page" : {
"LABEL" : "Create 1st Group Page",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules" ],
"ON" : [ "node_insert" ],
"IF" : [
{ "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "group" : "group" } } } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "post",
"param_title" : "Page 1 - Start here",
"param_author" : [ "site:current-user" ]
},
"PROVIDE" : { "entity_created" : { "grouppage_created" : "Created GroupPage" } }
}
},
{ "list_add" : { "list" : [ "grouppage-created:og-group-ref" ], "item" : [ "node" ] } },
{ "entity_save" : { "data" : [ "grouppage-created" ], "immediate" : 1 } }
]
}
}
Some more details about "my" variation, about the content types involved:
- "
Group
" is the content type I'm using for my OG groups.
- "
Post
" is the content type which has an Entity reference field with machine name og_group_ref
(and widget = OG reference), so that I can assign nodes of content type "Post" to the appropriate field. Be aware however, this field allows for unlimited values (not sure if that's your case also).
Some more details about the actual rule:
- Rules Event: After saving new content.
- Rules Condition: Content is of type
Group
.
Rules Actions:
Create a new entity
, of type Post
(note the grouppage_created
variable name I've used, instead of just the default entity_created
...).
Add an item to a list
, whereas the list is grouppage-created:og-group-ref
(a multi value field, remember, so you cannot/should not use "set a data value, a common mistake when creating custom rules ...), and the item to be added is ... you probably guessed it: the node (of type Group
), that just got saved.
Save entity
, for the grouppage_created
(not sure if this Rules Action is really needed, but IMO it's a kind of safe (best?) practise to be sure that this newly created grouppage_created
-entity also gets saved).
And yes I actually tested this rule in my own environment ... Sure enough, in my case a new node (of type Post
) got created, after I created a new Group
.
Your turn to adapt your rule (with your content types), to make it similar to my rule here (assuming you also allow multiple values for your og-group-ref
field. If yours is single value, then probably all you need to change is to replace the Rules Action Add an item to a list
by an action to Set a data value
(using similar variables).
PS: I'm assuming your question is about D7.