I have two content types - Review, and Business. Reviews have an entity reference field linking the review to the Business being reviewed. On the business page, I have fields that display the averages of the submitted reviews for different aspects of the Business. However, the average only updates itself when the node is saved. So, I need a way to automatically save the business page when a review referencing it is created. I'm assuming that the best way to go about doing this would be using Rules, but I am not sure what actions to assign to the Rules to make it tick. Any suggestions?
in rules (sorry the terminology is not exact) :
- action : node save
- condition : type = review
- select the bussiness from the review
- resave that business (you will have to force it probably)
or the same in a hook (node_api, operation save, nodetype review)
the best would probably be creating an agregated view end embedding that into your node (or attaching with a block, many possibilities)
So I thought I had submitted an answer already, but apparently it didn't submit. So, here's the quick and dirty. Under
content is of type select the type of content being saved. Next, under
fetch entity by id, click on
switch to data selctor under identifier. Next, enter
node:your-reference-field:nid. Create another action, select
save entity, and then select
entity fetched, which was made available in the previous step.