Struggling with the Entity is of type bundle input values

Created on 14 July 2023, over 1 year ago
Updated 15 July 2023, over 1 year ago

Hello. These instructions ( https://www.drupal.org/node/1300042#data-selection β†’ ) don't explain what to enter into the fields in enough detail to be helpful.

1. From the 'Select the condition to add' input, select Entities > Entity is of bundle.

2. From the 'Data selector' input select the entity you are targeting (don't use the entity with the colon, e.g. Person, not Person:).
Press Continue. You should now see a new 'Entity Bundle' fieldset, select the bundle name that you want to compare field values from.
Press Save.

In my case I have a custom Content Type called Contract It has text fields I want to write to. I tried various inputs but I could not see the fields from my custom Content Type no matter what I did. What should I enter in the Entity and Type fields please?

Thanks for your time and thoughts.

πŸ’¬ Support request
Status

Active

Version

3.0

Component

Rules Core

Created by

πŸ‡ΊπŸ‡ΈUnited States guymandude

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 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?

Production build 0.71.5 2024