Set title value of new content with "set data"

Last updated on
26 February 2022

This is a basic reaction rule example that sets a new Title value for any new content of type Article. An HTML formatted system message, using a Rules token, is also displayed.

Here is the rules.reaction.set_article_title.txt configuration for importing.

1) Adding new Rule.

Sample Add Reaction

2) Adding Condition, Entity is of bundle.

Add Condition

3) Adding Condition. Note the ENTITY is using the "data selector" and TYPE, BUNDLE use "direct input".

Add Condition Bundle

4) When saving, don't forget to clear the cache.

Add Condition - Save

5) Adding the first action, Set a data value.

Add Reaction

6) When setting the Data selector, the values are dynamic and show if available. This area of the UI is tricky at first but works well once you understand its behavior. (Hint, type "node.", click out of the box, click back into the box to see the next available level.)

Action Data Values

7) Adding second action, a system message.

Show System Message

8) A Direct Input value can use Rules token replacement like {{ node.title.value }}.

Show Message Data Values

9) The final screen of this reaction rule.

Final Settings

10) Adding a sample Article with a title that will be replaced by the rule.

Rules_Sample_My_Article

11) The final results when adding a new Article. The title has been changed to foobar.

Sample Rule Hit

Tags

Help improve this page

Page status: No known problems

You can: