1

OK, this is specific:

I have a content type with two fields:

  1. First is a expiration date field (d-m-y format);
  2. Second is a select list field: "green, red, yellow, empty"

WHAT I NEED:

When there is 15 days left for the expiration date of a specific node, the select list field from that node should automatically change to "yellow".

Is this possible using, for example, rules module? Is there any other option?

Thank you!

  • You can use a cron to check everyday day that kind of thing – DarkteK Aug 20 '16 at 2:20
3

Hmm.. This sounds like it could be done with Rules and VBO.

  1. Create a VBO view of nodes that match your date requirement using filter date field > relative date. You might also want to filter out nodes that have already been changed.
  2. Create a rule:

    • Event: Cron or maybe the Rules Once per Day module
    • Action: Load a list of entity IDs from a VBO view
    • Action: Loop list
    • Action: Change / Add field using Set a data value if it's a single value field or Add item to list if it's a multi-value field.

EDIT: As of November 2017, this feature whereby VBO supplies Rules has been a bit broken and requires a patch to work.

  • Hi, I tried to do that but I can't find the action "change field". First, I created a VBO...I added the Bulk Operation to change the select list field. When I see the view page I have the option to change to green,yellow, red etc and it is working great. I also added the filter to show only the nodes which date field is between today and 15 days ago and that is working. Now in the rules: I added event "Cron maintenance tasks are performed", I added no condition, and then in the actions I added just like you said. But I can't find the action "change field"... what am I doing wrong? thank you – Drii7 Aug 24 '16 at 17:52
  • Hi, I added components and I figured it out. You pointed me to the right direction so I'll accept your answer. Thanks – Drii7 Aug 24 '16 at 20:59
  • I should have said "Set a data value" for the last part. Glad it helped! – Niall Murphy Aug 25 '16 at 0:48
  • Hey Niall, I think you should integrate your last comment in your answer ... – Pierre.Vriens Aug 26 '16 at 8:11
  • 1
    @Pierre.Vriens Edited. – Niall Murphy Aug 26 '16 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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