How to access fields from a goal when creating a node with Rules? I'm trying to create a rule with the Rules module that posts a node when users achieve a goal (using the Goals module 7.x-1.3). I want to get fields from the goal like the goal image and other fields, but there's no data selector for the goal completed.

I can't find a way to fetch the completed goal entity. I've tried using a data comparison condition, but it'll only give "goal" data selector without any fields.

Any hints?
Have a look at this rule (in Rules export format), which is an example of how to get this to work:

{ "rules_show_a_message_after_goal_completion" : {
    "LABEL" : "Show a message after goal completion",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "goals" ],
    "REQUIRES" : [ "goals", "rules" ],
    "ON" : { "goal_awarded" : [] },
    "IF" : [ { "goals_goal_condition" : { "goal_id" : "2" } } ],
    "DO" : [
      { "entity_fetch" : {
          "USING" : { "type" : "goal", "id" : "2" },
          "PROVIDE" : { "entity_fetched" : { "goal_fetched" : "Fetched goal" } }
        }
      },
      { "drupal_message" : { "message" : "Some details about the \u0022[goal-fetched:ftitle\u0022 goal which you just completed:\u003Cbr \/\u003E\u003Cbr \/\u003E\r\n- \u003Cstrong\u003EGoal Description\u003C\/strong\u003E = [goal-fetched:field-goal-description]\u003Cbr \/\u003E\r\n- \u003Cstrong\u003EGoal Category\u003C\/strong\u003E = [goal-fetched:field-goal-category]\u003Cbr \/\u003E\r\n- \u003Cstrong\u003EGoal Level\u003C\/strong\u003E = [goal-fetched:field-goal-level]\u003Cbr \/\u003E" } }
    ]
  }
}


Some details about this rule:


Rules Event: "A goal is completed by a user", as in your question.
Rules Condition: "The goal completed by a user", a Rules Condition provided by the Goals module (disclosure: I'm its maintainer). In my case, I used the goal with goal id = "2" (replace with the goal id that matches your case).
Rules Actions:


"Fetch entity by id", whereas the entity is a goal, and the id of it is (also) "2" (replace with the goal id that matches your case).
"Show a message on the site", which is just to demo / test some of the field values related to that goal (adapt the machine names of those fields to match your field names).



So by adding the Rules Condition "The goal completed by a user", and by also adding the Rules Action to "Fetch entity by id", in any subsequent Rules Action you should have access to all fields of the goal (with the goal id that matches your case).