I have a set of rules that looks like this:

  1. (rule) When flag A is set, do this:
    1. (action) set field X on flagged content
    2. (action) save flagged content
    3. (action) set flag B on flagged content
  2. (rule) When flag B is set, do this:
    1. Create new node
    2. (action) copy field X on flagged content to field Y in the new node

The problem is that the second rule does not see the new value of field X set in the first rule. It seems that this is caused by the fetch_content() method in flag_flag which caches the node too eagerly. Adding a "load content" action to the second rule which loads a node based on the flagged content's node ID (effectively reloading it) helps.

This is a problem because it introduces tight coupling between these rules (reloading the node in the first rule and flagging the reloaded node there didn't help!); the second rule needs to know it might be triggered as a result of executing the first rule (it can also be executed manually in the site I'm using this in).

Comments

quicksketch’s picture

Project: Flag » Rules
Version: 6.x-1.3 » 6.x-1.4
Component: Rules integration » Provided Rules integration
Category: bug » support

Apologies for the lack of updates in this issue; I don't regularly participate in any of the issues that involve the Rules integration in Flag. I'm not sure if such a Rule exists, but it sounds like you need a rule that flushes the $node cache after "(action) set field X on flagged content". There may even be a simple Rule for "save node" that would do the job.

In any case, I think this is a general issue with Rules rather than Flag (since you'd have the issue with any updates to the node), and likely a support request.

quicksketch’s picture

Apologies above for my explanation, as I'm almost positive I mixed up "Rule" with "Action" in my terminology.

mitchell’s picture

Component: Provided Rules integration » Provided Module Integrations
Status: Active » Fixed
Peter Bex’s picture

That's a different sort of cache

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Peter Bex’s picture

Status: Closed (fixed) » Active

wait, what? This issue isn't fixed!

TR’s picture

Component: Provided Module Integrations » Rules Core
Issue summary: View changes
Status: Active » Closed (outdated)