Problem/Motivation
The first set of code runs but fails to insert a promotion content item when an article is created. The second code example, D7, works brilliantly.
Drupal 11 : Create a promotion content item when an article is created
uuid: 4c91872c-8cf8-4688-a0ba-3a5705ceb11a
langcode: en-gb
status: true
dependencies: { }
id: article_create_1
label: 'Article create 1'
events:
-
event_name: 'rules_entity_insert:node--article'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: 05149d68-8557-4293-9174-6badc8e5a684
weight: 0
conditions:
id: rules_and
uuid: b7c7e9d1-4248-4f02-baaa-b813a2f9669f
weight: 0
conditions: { }
actions:
id: rules_action_set
uuid: b568101d-9021-4e65-a29f-55e9da956494
weight: 0
actions:
-
id: rules_action
uuid: 926a6d7b-6487-444c-bc1c-e7c354b44fd2
weight: 0
action_id: rules_system_message
context_values:
message: 'Article created [node.title.value]'
type: status
repeat: false
context_mapping: { }
context_processors:
message:
rules_tokens: { }
type:
rules_tokens: { }
repeat:
rules_tokens: { }
provides_mapping: { }
-
id: rules_action
uuid: 253f83ff-d536-480a-9920-695d7350ac5a
weight: 0
action_id: 'rules_entity_create:node'
context_values:
type: promotion
title: DDDDDDD
context_mapping: { }
context_processors:
type:
rules_tokens: { }
title:
rules_tokens: { }
provides_mapping: { }
Drupal 7 Version
{ "rules_add_article_and_promotion" : {
"LABEL" : "Add article and promotion",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert--article" : { "bundle" : "article" } },
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "promotion",
"param_title" : [ "node:title" ],
"param_author" : [ "node:author" ]
},
"PROVIDE" : { "entity_created" : { "promotion" : "Promotion" } }
}
},
{ "data_set" : { "data" : [ "promotion:title" ], "value" : "[node:title]" } },
{ "data_set" : { "data" : [ "promotion:body" ], "value" : [ "node:body" ] } },
{ "entity_save" : { "data" : [ "promotion" ], "immediate" : "1" } }
]
}
}
Steps to reproduce
Import code into a D11 site
Proposed resolution
Guidance over what is wrong with the D11 rule.
Comments