Short version: I want to fetch a relation by the endpoints. The relation already exists in the database. How can I use the Fetch entity by property action to return the relation?
Long version:
I'm using the Rules and Relation modules on Drupal 7. I have a relation type that is created between two users (the endpoints are user entities). The relations I am trying to fetch have already been created.
When one user sends a message to another with the Private Message module, I want to fetch the relation between the sender and the recipient.
Here is the rule:
Event: A message is sent (from Privatemsg module)
Action: Add a variable (List of any entity items, endpoint_list
)
Action: Add an item to a list (Add privatemsg-message:author
to endpoint_list
)
Action: Add an item to a list (Add recipient
to endpoint_list
)
Action: Fetch entity by property (Entity type: Relation, Property: Endpoints, Value: endpoint_list
, Limit results: 10, provides fetched_relation
)
However, when I try to perform another action (loop, data comparison, data set, etc.) on fetched_relation
, I get the following error in the rules debug log:
4.468 ms Unable to get the data value for the variable or parameter value. Error: Missing data values.
It appears that the relation is not fetched. However,
- I am sure the relation exists in the database with the correct endpoints (the relation appears in the UI correctly and I even checked the MYSQL table).
- When I add an action Print message and print
privatemsg-message:author:name
andrecipient:name
, it shows me the names of the correct users, so those variables appear to be correct. - I have looked at the documentation for fetching relations with rules but I can't see what I am doing wrong.