- Issue created by @guymandude
- πΊπΈUnited States tr Cascadia
These instructions
Those instructions are for Drupal 7, so they're not exactly correct for Drupal 8+.
I have a custom Content Type called Contract
If it's a custom content type, then the entity is "node" and the type is the machine name of your type, which I assume is probably "contract".
- πΊπΈUnited States guymandude
Thanks for responding TR. I'm still struggling. I have attached a screen recording to show you what's going on. Hopefully it will shed some light.
- πΊπΈUnited States tr Cascadia
You're using the event "Cron maintenance tasks are performed", which has nothing to do with nodes so there is no "node" in context. I'm not sure what you're trying to do, but using the "Cron" event usually indicates to me that you're thinking about the problem the wrong way. How does your Rule know which node to look at?
Also, if you're trying to debug a Rule, a non-interactive event like "Cron" makes that very hard.
Because there is no "node" in context for this event, and no "node" in global context (that's the @node thing in the data selector), there is no node-type data to operate on. Rules can't determine what the valid fields are on that node if there is no node available. My comment assumed you would have a node in context, because that's the only reason you would need to test the node in a condition.
The event adds data to the context. Node events like "After content is updated" will add the node to the context - there is a specific node that is being updated and that's the node that can be tested by later conditions. The data selector will show you the data available in the context. Global context variables like @node will always be present because those variables are defined in a global scope by Drupal core, but they won't always have values.
- πΊπΈUnited States guymandude
Thank you! You're right, I'm not thinking about this the right way. I was using Cron just as trigger without realizing it provides context. It's an easy way to quickly test a Rule. I assumed adding the Entity as a bundle provided any necessary context. I'm going to play around with Rules again with this new perspective.
BTW, The objective I am trying to accomplish is having nodes (Contracts) with start and expiration date fields that can be up weeks/months/years apart. I planned to use Scheduler to fire off an email say 90 days before the expiration date. The email would link to that contract where a multi-value field called something like 'next reminder' can set a duration like 7, 14 30 days out. When the node is saved Rules would change the expiration date field using the current time and offset by the selected value (7,14,30 etc), and schedule another email to be sent on the new expiration date. This way the Contract owner can get multiple reminders about the expiration in advance of the actual expiration date.
Does this sound doable?