3

One content type in my Drupal page has a date field. After importing start hour, start minute and duration (Integer values) from an XML file, I want to set date field of the node via Rules. It seems that I cannot access the start date and duration of the date field.

Is there a solution to set the start date, end date, repeating, etc. ?

2 Answers 2

2

Before you will be able to create a Rules Action like "Set a data value" for your date field, you have to make sure to add a Rules condition Entity has field (related to the field for which you want to set a value). And make sure to add that Entity has field condition BEFORE other Rules Conditions in which you might want to refer to this field.

That's also what is mentioned in the Rules UI, e.g. when you're adding a "data comparison" condition: somewhere it says:

The data selector helps you drill down into the data available to Rules. To make entity fields appear in the data selector, you may have to use the condition 'entity has field' (or 'content is of type').

For a video tutorial that illustrates the importance of this Entity has field condition, refer to Data types and data selection, especially what is shown between about 13:30 and 17:30 in it.

1

I've been able to do something similar to this using Rules, Rules Link and VBO, wherein I alter the date field (using the Date module) of an Entity with a custom input used as a parameter in Rules when executing the rule via VBO, I did have to check that the Entity had the required field (as a condition) before being able to populate that field with the parameter input.

I hope that helps.

1
  • my brain hurts now Commented Jun 3, 2016 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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