My 'Article' nodes have a Field Collection, called 'Amounts', that contains an integer field. After deleting a Field Collection item, I'd like to substract some Userpoints from the node's author, based on the sum of the integers in the non-updated and updated node.

In order to do so, I created a Rule with the event "After updating existing content of type Article" in which I'm looping over 'Amounts' for the updated and non-updated node. The problem is that both loops use the data from the updated node (after the Field Collection item was deleted, that is), resulting in identical values.

Here's the Rule's output for a node that has 3 items with corresponding values 1, 2 and 3 after deleting the first item:

Non-updated node: Sum = 5. (This should be 6.)

Updated node: Sum = 5.

Is it possible to run the Rule before deleting the Field Collection item in order to be able to grab the necessary data values? Is there another way to use the deleted data?

2 Answers 2


Instead of trying to get access to the deleted value with Rules, it's easier to store the sum in a new hidden field, called "Sum". In that way, the 'old value' will always be available in any Rule. Just make sure that you update "Sum" when a new Field Collection item is saved or an existing item is deleted. That can easily be achieved with another Rule.


Your own answer seems like a workaround which works for you, but doesn't really address the core of the issue you mentioned in your question, i.e. what you described as "The problem is that both loops use the data from the updated node".

However, instead of using Rules Event "After updating existing content of type Article" (as in your question), you should use Rules Event "After updating an existing field collection item", combined with the typical rules Condition "Entity has field" (for your field collection field). In doing so, you will have access to both the changed (after save) and unchanged (before save) values. And therefor pretty sure also to the values before they are deleted.

For an example of a rule that uses this "After updating an existing field collection item" Rules Event, refer to my answer to "How to get the pre-save version of a field collection in rules".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.