Needs review
Project:
Field collection
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2012 at 09:09 UTC
Updated:
3 Dec 2015 at 17:05 UTC
Jump to comment: Most recent
Comments
Comment #1
jmickelaDid you ever get anywhere with this?
I have a content type that has a multi-value field collection and I would like to be able to add new values with a rule.
Comment #2
jibus commentedSame here =)
Comment #3
kaizerking commentedselect delta value 0 to set new value
Comment #4
busla commenteddoesn´t that only add a value to the first field collection item? What happens if you add another item with delta:1 ?
Comment #5
funkeyrandy commentedanyone ?
Comment #6
vadym.kononenko commentedI'm trying to use this way too. But it is not work now.
https://drupal.org/node/1822844
This patch solved my problem. But I don't known if it will fix work of the Rules with FieldCollection revision operations.
I've debugged it and allocated Rules load the HostEntity FieldCollection field without revision_id value and save it after that.
As I see it fixes just view of the FieldCollections list.
Comment #7
Anonymous (not verified) commentedTime has past, but this seems to be possible like this:
rule:
*event - After saving node of type (any type with the field collection in it)
*condition - none
*action
1. (Loop if multiple items needs to be added)
2. Create new entity > field collection item > fill in the 'field name' and 'host entity'
-provides variable 'entity_created'
3. Set data value
-entity_created:field_(the field you wish to add content to - my case: field_left and field_right)
Comment #8
Anonymous (not verified) commentedComment #9
Anonymous (not verified) commentedOh, and if you need to update existing field collection item values (as asked in the question...) this should work:
1.loop through the field collection
2.fetch entity by id (current-list-item:fiel_collection_item_id)
3. create component of type Rule and ad this to the loop as an action.
4. component parameters:
4.1. entity: field collection item (from the loop)
4.2. text (or any type of data you want to add/edit to field collection item field)
5. component condition: Data comparison > Data to compare: [current-fc-item:field-name], Data value: Field collection field name > select your field collections name.
6. component action: set data value > entity:field_example > text (or any_type_of_data_field from parameter)