Just wouldn't work! It would replace the existing values. When a team member who's location is both Canada AND France is added, the project's location becomes United Kingdom, United States, Canada, and France. When a team member from 'United States' is added, the project's location field would have 'United Kingdom' and 'United States'. So for instance, a project node with a team member from the United Kingdom would also have on its location field, 'United Kingdom'. I need to create a rule so that when a 'team member' node is created, its location is added to the project node without replacing existing content. On the project node I have those exact same fields. Each team member has on its node a location, ie, 'United Kingdom', 'United States', 'Australia'. create a new Rules Action (with the new value myNewestNiceImage).My question is about: "adding field data to referenced node without replacing existing data".įor example, I have a project node with team members referencing the project.delete the Rules Action (with the old value myNiceImage).However, here are the steps I performed to actually get the value updated (from myNiceImage to myNewestNiceImage) anyhow: So it seems like updating a Rules Action is not what you should try to do (at least not in the current D8 release of the Rules module). Unable to get variable node:field_image, it is not defined. The context Data may only be configured using a selector.īy clicking on the Switch to data selection button (so that the button label changed to Swith to direct input mode), and trying again, I got another error message like so:ĭata selector node:field_image for context Data is invalid. But, that resulted in an error message like so: So I returned to my Rules Action, and started to edit it. So far so good, but next I wanted to update the value to be assigned in my Rules Action, let's say myNiceImage should be updated to myNewestNiceImage. because otherwise I could not have exported it, right? The above export should illustrate that I could perfectly save this. Label: 'Check a field before saving a node' You should then see the exported rule, which should look similar to mine, i.e.: uuid: ab289332-0b45-484f-a1ae-38842620b7e4 Then select the label of your rule as the "Configuration name". Navigate to admin/config/development/configuration/single/export and as "Configuration type" select "Reaction Rule".Navigate to /admin/config/workflow/rules to ensure the rule was really saved (that it does show up there).Then a message will be shown like "Reaction rule ABC has been updated." (ABC = the label you gave to your rule). Click the Save button (to save the rule). And it shows a message like " You have unsaved changes.". You are then returned to the "edit rules reaction" screen (for the rule you are editing.Then click the Save button (to save the Rules Action). And also enter some "Value" (within the "Value" box), eg myNiceImage. Add a Rules Action "Set a data value",and continue like so: click on "Value" (within the "Data" box), and select node:field_image:value (note that for this Data Selector I'm using : (twice), instead of.Then click the Save button (to save the Rules Condition). And also click on "Value" (within the "Field" box), and select field_image. To do so, click on "Value" (within the "Entity" box), and select node. Add a Rules Condition like "Entity has field" (for the field_image field).Use Rules Event "Before saving content".Navigate to /admin/config/workflow/rules and create a new rule, with these details:.Navigate to /admin/structure/types/manage/article/fields to verify this.I'll use content type "Article", which already has a field with machine name " field_image" (out of the D8-box).With that in mind, read on for more details to do a similar experiment with rules 8.x-3.0-alfa1. is a preview release and is not intended for production sites. Be aware of what's written in comment nr 7 of issue nr 2574691:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |