I'm trying to create a custom rule (using the Rules module) so that every time the cron runs, this rule checks a date field in a custom content type I created. If that date has passed then I want to set a list widget from active
to ended
.
This is how far I get when trying to create this rule:
- Set
React on event
toCron maintenance tasks are performed
Add Condition
> SetSelect the condition to add
toData comparison
> Continue
Here is the issue: Data selectors
only has site
and no access to field data.
Any ideas where I'm going wrong here?
You need to create a rules component first:
I state: I do not know if it works but at least it should direct you towards the right path
Sorry for my english, I hope you understand everything :)
The problem with Rules condition "Cron maintenance tasks are performed" is that at that point, there is no access to the node object so any checks/manipulations on the node are not possible. As a solution, instead of Event = Cron maintenance tasks are performed, use Event = Node: Content is viewed. You can leave it open for any content type so that when someone visits the website and opens at least one page, some action will be triggered.
Yes you should be able to get this to work using the Rules module to implement what you're looking for, but I recommend you to also combine that with the Views Rules module. Some details about this module (from its project page):
The previous quote may seem a bit cryptic (it may make you think like "so what, how can this help me?"). Therefor some more details about how to move forward using these modules:
active
toended
*" (as in your question). Important: use a Views display type of "Rules".active
toended
). At that point you'll have all data from each column of your Views results available as so called Rules Parameters. So at that point it's a piece of cake to adapt the value of that list widget for the node you're processing in that loop.Easy, no?