How to check in a rules condition if an image field has value? Is there any way to check if a field has no value (image field) after saving the content in Rules? I tried Data Value is Empty, but it doesn't work!

Output of the rules:

{ "rules_autos_featured_listing_without_image" : {
    "LABEL" : "Autos: featured listing without image",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "autos" ],
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--listing" : { "bundle" : "listing" } },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_listing_grouping" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_feature" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_images" } },
      { "data_is" : {
          "data" : [ "node:field-feature" ],
          "value" : { "value" : { "feature" : "feature" } }
        }
      },
      { "data_is_empty" : { "data" : [ "node:field-images" ] } }
    ],
    "DO" : [
      { "data_set" : { "data" : [ "node:field-listing-grouping" ], "value" : "1302" } }
    ]
  }
}
Make sure the field you are trying to "test" (for its value), is available at the time Rules tries to do so.

That's why I always add a entity_has_field condition (and put it as the first condition) which looks something as in this example (part of a rules export of some rule):

"IF" : [
  { "entity_has_field" : { "entity" : [ "account" ], "field" : "field_next_appointement" } }
],


In my sample here, it is related to entity account, and my field's machine name is field_next_appointement.

So retry your rule with the Data Value is Empty condition, but put such entity_has_field condition in front of it. So that in the end your rule has 2 conditions (no PHP coding at all involved), something like so:


entity has field ...
NOT Data Value is Empty ...


Below is a (simple) rule from my training class examples. It'll display a message like "Watch, this is ONLY 100 EUR !!!!" for a node which has a field_article_price field, whereas that price is exactly 100 EUR.

{ "rules_this_article_is_for_sale" : {
    "LABEL" : "This article is for sale",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_view" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_article_price" } },
      { "data_is" : { "data" : [ "node:field-article-price" ], "value" : "100" } }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "Watch, this is ONLY 100 EUR !!!!", "type" : "warning" } }
    ]
  }
}


Looking at your (updated) question (now including your current rule), I think you should try to work step-by-step to investigate which part of your rule "doesn't" work. If I was in your shoes, I'd experiment with these variations (only for debugging):


Replace the ACTION with just a drupal_message:


if you get a message then, your problem is within ACTION. Todo: fix the Action.
if not your problem is in the EVENT of CONDITION(s). Todo: go to item 2.

Remove all CONDITION(s): 


if you get a message then, your problem is within CONDITION(s). Todo: fix the CONDITION(s).
if not your problem is in the EVENT. Todo: go to item 3.

Review the EVENT: if the event you're trying to use to make the Rule work does not actually happen, or if you're "too late", then of course that needs to be fixed/reviewed. In my experience, there are quite a few Rules scenarios where you should use "When Drupal is initializing". My (personal favorite) sample of that is about "before content is going to be viewed" ...


I realize the above 3 steps do not actually "answer" your question, but they may help to debug what's actually the problem.