1

I have a content type with a set of fields.

Hundred(s) of pieces of content have been created from this content type.

I recently had to go back and add a new field to the content type.

In order for all content of that content type that I previously created to show the newly added field, I have so far been going into each piece of content and adding in the field. This is going to take forever.

Is there another tool or process I can use to update all previously created content with the new field added to the content type?

4 Answers 4

1

Step 1

Use the Rules module to create a Rules Component, which includes whatever Rules Conditions you might need (if any), and with a Rules Action to Set a data value, for each of those fields you want to be updated.

Step 2

Create a view of the nodes for which those fields should be added. Then transform that view into a view that uses Views Bulk Operations, and use the technique documented in "How to use Rules to create a custom bulk operation for a VBO view?". In doing so, you'll then be able to use the Rules Component from Step 1.

Tutorial

To get the idea, have a look at the video about Using Rules components with VBO" which uses a Rules Component with (only) 1 parameter. If you want even more, then also watch the subsequent "Using Rules components with more than one parameter" video.

Attention: to process like 100.000 entities at once is quite a challenge (memory requirements, etc). Therefor you might want to also watch the video about "More details about VBO settings" ... Before you are tempted to use VBO for processing them all at once ...

1
  • @lcunning merci for the accept (and +1)! Feb 14, 2018 at 17:47
1

if I understand correctly you need to update node in range of new date? right? so if this is the case why not use EntityFieldQuery() to list of this nodes then node_save() or field_attach_update() to update the new value.

if this is the case I'd be happy to give you some snippets to help you do this.

1

I would recommend Views Bulk Operations for this. You can make a quick view to select the content with a modify action to set the value. No programming needed.

VBO is a great tool to keep handy for a lot of stuff like this.

1

Existing Question, Please refer the below link

As they mention use Devel module to Run PHP code.

Bulk Field Update

Your Answer

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

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