I'm now thoroughly confused about trying to set a Rules Condition on a select list. There are two things I want to do:

(a) On a new node of my content type I want to trigger when a certain checkbox in the select list is checked

(b) When a node of the same content type is edited I want to trigger when the state of the checkbox has changed.

For (a) I start out with a Data Comparison and put the name of the select list (node:field-pbxq-stock-status) in Data Selector. On the next page I choose "Is one of" for the Operator and then my list of Data Values disappears, so I cannot select the one I want. It won't allow "node:field-pbxq-stock-status:In stock" or "node:field-pbxq-stock-status:3" (3 is it's index) in that Data Value/Data Selector field.


These are two more comparisons I've tried.
Both are: After saving new content of type PBX Quote

Text Comparison
Data selector: node:field-pbxq-stock-status:3
Matching text: In stock
Value: contains

List contains item
Selected list: node:field-pbxq-stock-status
Data selector: node:field-pbxq-stock-status:3

In both of those cases I'm using the '3' because I -think- thats suppose to be the list offset? I'd much rather compare without dependency on offset, eg:
Some type of comparison
Selected list: node:field-pbxq-stock-status
Matching text: In stock
Value: contains

  • What action are you reacting on in your rule?
    – Brady
    Commented Sep 30, 2015 at 5:21

3 Answers 3


Below is a sample of a rule (in Rules export format) that should allow you to specify a Rules condition relation to a specific value selected via a selection list (and when a new node is created):

{ "rules_new_node_with_special_optionlist_value" : {
    "LABEL" : "New node with special optionlist value",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_optionlist" } },
      { "data_is" : { "data" : [ "node:field-optionlist" ], "value" : "C" } }
    "DO" : [
      { "drupal_message" : { "message" : "A new node got created with option list value = Custom" } }

Some more details to further explain the above above sample:

  • The Rules event I'm using is "After saving new content".
  • In my case I have a selection list field with machine name field_optionlist.
  • This field actually has 3 possible values, like so:
    • A (=Advanced).
    • B (=Basic).
    • C (=Custom).
  • As a sample, I decided to use as condition "The selected value must be Custom".
  • If that value is selected, then (as Rules action), a message is shown like A new node got created with option list value = Custom (feel free to change that to whatever Rules action, this is how I often "unit test" new rules I write).

The "clue" to make this rule work is the condition Entity has field. That's also what is mentioned in the Rules UI when you're adding a "data comparison" condition: somewhere it says "The data selector helps you drill down into the data available to Rules. To make entity fields appear in the data selector, you may have to use the condition 'entity has field' (or 'content is of type')". I wouldn't be surprised if that is what you are missing in the rules conditions you tried so far ...

Note that I've not added a Rules condition here about selected content types, that's probably an extra condition you might want to add also. But if the selection list field is only used for the content types you're interested in, then the Entity has field condition should be sufficient already.

For a video tutorial that illustrates the importance of this Entity has field condition, refer to Data types and data selection, especially what is shown between about 13:30 and 17:30 in that video.


React on "after saving new content"

use TEXT COMPARISON instead of Data Comparison

Under Matching Text put the name of the "a certain checkbox" that your talking about.

  • That sounded like a good idea but still no luck. I had hoped to pick the select list and then enter the "In stock" text but I can't select the list, it seems to require a ":#" at the end of it. Even when using ":3" or ":2" it still doesn't trigger.
    – user51484
    Commented Oct 1, 2015 at 3:24

Data Types and Data Selection

  • How to use data selection to explore available data and drill down to selected properties
  • Using the data comparison condition
  • Using the set a data value action
  • That Rules recognizes different types of data,and verifies when necessary
  • That Rules knows that not all data is writable, and verifies when necessary
  • How to create composite tokens, extending the tokens listed in the replacement patterns
  • Making field values accessible to Rules
  • Using reference fields to access new data, such as tags on an article or nodes in a node reference field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.