By Asif Khan


2019-07-12 00:01:15 8 Comments

I have a dropdown in a node and the id of the dropdown is "field_b_status". I want to add condition in a rule if the drop down value is equals to one of the value "Complete" then send email.

When i try to add that, i see the error. Data selector field_b_status.value for context Data to compare is invalid. Unable to get variable field_b_status, it is not defined. Please see the screenshot: enter image description here

Can you please help me how to add dropdown "field_b_status" in the condition?

2 comments

@mak 2019-07-12 18:42:00

Rules in Drupal 8 doesn't have much flexibility. So in your case, you will do the following to achieve it.

Under Data selector, you will type: {{node.field_b_status.value}} and choose Direct mode instead.

And rest will be similar to your screenshot.

@anonymous 2019-07-14 05:05:23

The problem is that field_b_status.value is not a valid value in the data selector. I guarantee that it does NOT show up in the autocomplete for the data selector. Why? Because it is not fully qualified. If you want a field value, you need to also specify the entity that the field belongs to.

The solution is, when using the data selector, choose one of the values listed in the autocomplete for the data selector - DO NOT type in your own value. What you want to select is probably something like node.field_b_status, or node.field_b_status.value, depending on what type of field field_b_status is, whether it's a single-valued or multiple-valued field, and depending on how the event provides the entity context (I assume it's something like "node", but it doesn't have to be ...).

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] How to validate dependent fields for a content type?

  • 2016-07-27 09:07:08
  • rks
  • 559 View
  • 1 Score
  • 1 Answer
  • Tags:   rules

1 Answered Questions

[SOLVED] Data selectors for custom fields

  • 2018-01-17 18:18:16
  • James Naish
  • 363 View
  • 3 Score
  • 1 Answer
  • Tags:   8 rules

4 Answered Questions

[SOLVED] What's wrong in my rule for sending e-mails using VBO?

2 Answered Questions

[SOLVED] Rule to Send email to Admin when user points category reaches a certain value

  • 2013-11-21 14:35:37
  • danielesus
  • 150 View
  • 2 Score
  • 2 Answer
  • Tags:   rules userpoints

2 Answered Questions

0 Answered Questions

How to compare value of custom field with the Rules module?

  • 2017-02-16 10:05:02
  • J. Dough
  • 570 View
  • 1 Score
  • 0 Answer
  • Tags:   8 entities rules

2 Answered Questions

[SOLVED] How to validate fields with the Rules module?

  • 2014-05-05 14:41:20
  • Adamtan
  • 2324 View
  • 2 Score
  • 2 Answer
  • Tags:   rules

2 Answered Questions

[SOLVED] add amount to shipping cost per product

  • 2014-02-06 20:23:11
  • Yusef Mohamadi
  • 1480 View
  • 3 Score
  • 2 Answer
  • Tags:   rules commerce

2 Answered Questions

[SOLVED] Rules Workflow: Data selector is invalid

  • 2013-02-08 06:14:21
  • user13667
  • 2467 View
  • 0 Score
  • 2 Answer
  • Tags:   7 rules workflows

2 Answered Questions

[SOLVED] Rules - send email when users role changes to x

  • 2014-03-19 12:36:24
  • Paul Trotter
  • 1237 View
  • 1 Score
  • 2 Answer
  • Tags:   7 rules users

Sponsored Content