Rules Action: Set a data value - for a date field

Events happening in the community are now at Drupal community events on www.drupal.org.
mcferren's picture

Hi there,

I am attempting to create a rule that automatically creates a group event node when a group post node is created by the users. Once things are said and done, I'd like to use that group event node in a calendar view.

My Event is................. After saving new content
My Condition is............. Content is of type - Parameter: Content: [node], Content types: Post
My Actions are..............

  • Fetch entity by id
    Parameter: Entity type: Node, Identifier: [node:nid], Revision identifier: [node:vid]
    Provides variables: Learning Link (node)

  • Fetch entity by id
    Parameter: Entity type: User, Identifier: [site:current-user:uid]
    Provides variables: Contributor (user)

  • Create a new entity
    Parameter: Entity type: Node, Content type: Event, Title: [learning_link:title], Author: [contributor]
    Provides variables: New Event (node)

  • Set a data value
    Parameter: Data: [new-event:group-audience], Value: Value: [node:group-audience]

  • Set a data value
    Parameter: Data: [new-event:field-article-reference], Value: [learning-link:nid]

  • Set a data value
    Parameter: Data: [new-event:group-content-access], Value: [node:group-content-access]

I am having the following problem that I'm hoping you can help me with: I am running into a wall when I try to add an action to populate the date field of the new event node. I am attempting to Set a Data Value with new-event:field-date as the Data Data selector * and site:current-date as the Value Data selector. When I click save, I am getting this error that prohibits me from populating the date field:

The integrity check failed with the following error message: "The selected data property doesn't support writing."

I get the same result when I try this for the Value Data Selector: node:created or this as well: learning-link:created I receive the same error when i click the Switch to the direct input mode and try the static default date: 2011-05-16 17:30:54

Many thnx in advance for your help.

-Ben

Comments

I belive setting the value

martinyde's picture

I belive setting the value for a date field is a feature not yet implemented in rules.
More on the matter:

http://drupal.org/node/1057434
http://drupal.org/node/1153766

@mcferren... I know it's been

lofos1's picture

@mcferren... I know it's been over a year, but I'm very curious to know if you got the "set data value for group-audience" action in your rule above to work.

I have been trying to do something similar in d7 with OG, Profile2 & User account where I'm trying to get the value for the user's Profile group-audience field from the user's Account group-audience field. I configured the action as "Set a data value --> Parameter: Data: [account:profile-main:group-audience], Value: Value: [account:group-audience]."

However, I get the following error in Rules debug log every time the the action fires... "Unable to modify data "account:profile-main:group-audience": Unable to set the data property group_audience as the parent data structure is not set."

I checked, and the user account group-audience has a value in it. Any suggestions if it is a problem with my rule configuration?

--The problem I'm trying to solve is to control user profile visibility based on Group membership.

Got the same issue, any

Yuri's picture

Got the same issue, any solutions found? I expected Rules to offer a direct imput mode for group audience (set data)..it hasnt..

Can be done with PHP filter..

davewilly's picture

Something like this. My use case was inserting hybridauth date of birth fields into a profile2 date field:

if(!empty($account->data['hybridauth']['birthDay'])
&& !empty($account->data['hybridauth']['birthMonth'])
&& !empty($account->data['hybridauth']['birthYear'])) {

  $entity_created->field_student_dob[LANGUAGE_NONE][0]['value'] =
  $account->data['hybridauth']['birthYear'].'-'.$account->data['hybridauth']['birthMonth'].'-'.$account->data['hybridauth']['birthDay'].' 00:00:00';

}

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: