This may be chalked up to my not understanding Rules fully, but how can I set field values for a flag from Rules?

My use case is a wedding registry: I set a 'purchased' flag on a product on Checkout, which has already been flagged for 'added to registry' by the Wedding Couple. The problem is that after checkout, I'm not able to specify the quantity that was purchased, which should be a field attached to the flag?

Thanks!

Comments

akalata’s picture

Status: Active » Postponed

Rules integration with the 7.x-3.x branch is limited (possibly non-existent). The Flag maintainers have requested help with Rules (see #1736524: Rules maintainer / decouple Rules integration to a new project) but nobody has stepped up yet.

You may want to try the 7.x-2.x branch and see if that helps you better?

shabana.navas’s picture

If I understand you correctly, the process works fine in the 7.x-3.x branch. Here are the steps you need to perform:

1. Set up your flag
2. Go to rules, add a new rule, which, triggers upon checkout.
a. The condition for the rule (this basically allows you to see the field values for that content type when you setup your action):
- Content is of type,
- Parameter: Content: [flagged-node], Content types: Article (your content type in this case)
b. The action for the rule:
- Set a data value
- Parameter: Data: [flagged-node:field-my-field] (the purchase field in your case), Value: [site:current-user:uid] (the quantity no. in your case)

Basically, if you figure out how to use the data selectors, then, understanding the way Flags and Rules work becomes a lot easier. In my opinion, I really don't think Flags integration with Rules is non-existent.

shabana.navas’s picture

Status: Postponed » Needs review
shabana.navas’s picture

Status: Needs review » Fixed

Marking as fixed. Since there are no responses for it, I am going to believe it worked.

RuarriS’s picture

Actually, I was not able to get it to work.

I had problems with the Content:[flagged-node] part: it doesn't know what node is flagged, if you set the rule to trigger on checkout. The Content would be the Order, right? In this scenario, the flagged product is attached to the line item, if that sounds correct.

Is my logic off, in how to get this to work with rules?

  1. Wedding Couple flags a product with 'Add to Registry' with a quantity field set
  2. Customer browses products flagged with 'Add to registry' for the Couple, and purchases item in the Customer's desired quantity. (So if the Wedding Couple only wants 20 of one item, no single person buys them all)
  3. Rule is setup to verify that the Customer actually bought the product, and in what quantity
shabana.navas’s picture

Will take a look at this again and hopefully post a solution to it.

Status: Fixed » Closed (fixed)

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

akalata’s picture

Status: Closed (fixed) » Active
Yuri’s picture

Issue summary: View changes

Any updates on this? I'm trying to set Flagging field values in Rules, but can't see how to fetch the flagging entity in order to get the fields available.
Tried php also..without luck.

shabana.navas’s picture

kopeboy’s picture

I don't think the answer is in that issue (I replied there).

joachim’s picture

Status: Active » Closed (duplicate)

Closing this as the other support request is the same question.

kmstf’s picture

dear shabana.navas can you tell me in same situation how we can change the field value filled a term.

for e.g. a node has a taxonomy term field filled a value "newyork"

i want to change this value as "boston" which is already predefine in vocabulary

thanks a lot!