Bulk editing
The ScaleCM app allows you to make scripted changes to any number of entries in your Contentful space without having to know how to code.
Steps to a successful bulk edit in Contentful with ScaleCM:
- In the ScaleCM dashboard, define the filters for entries that you want to edit (similar to how you would search Contentful).
- Check the results returned by your filters to make sure you are targeting the right entries. You can now select one or more (or all) entries by clicking on a checkbox next to an entry you want to select. As soon as you make a selection, a "Bulk edit" button will show up in the top toolbar.
- Click on the "Bulk edit" button and choose the operation that should be executed on your entries (You can add multiple operations and they will be executed sequentially. If any of them fails, the subsequent operations will not run to prevent data corruption).
- (Optional) Run the editing in a "Dry run" mode. This serves as a sanity check and will go through all of the changes without actually making them, giving you a sense of what's going to happen.
- Run the editing, leave the tab open until the app finished your edits.
Filtering entries
Your first step with any edit is specifying filters to find the right entries. You want to be as specific as possible here for several reasons:
- You don't want to edit entries you did not mean to
- Fewer entries = quicker bulk editing completion
- Fewer entries = easier to revert the changes if so desired
For the most part, the filtering works identically to the standard Contentful search, only with a slightly different UI/UX.
Selecting entries
Now that you have filtered the entries, you can choose which of those filtered you want to include in your bulk editing. Start by selecting at least one entry by clicking on a checkbox next to it. When at least one entry is selected, selection controls will appear in the toolbar to optionally select all of the entries matched by the current filters.
Configuring operations
"Operation" is a change executed on an entry. There are two types of operations: operations on whole entries (publish, unpublish, delete, etc.) and operations on fields (set value, clear value, etc). You can add multiple operations, and they will be executed sequentially (one after the other). If the previous change fails for whatever reason (for example, you not having permission to make a change or Contentful API being down), subsequent operations of that same entry will not be processed (to avoid unexpected results).
Operations on entries
These operations affect entries as a whole. You will often use them in conjunction with field operations (for example to publish an entry after making a change to its field).
Operations on fields
These operations target a single entry field. They are more complex and come with additional configuration. At a minimum, you will need to specify which field you are targeting with the operation.
For example, to set the value of a field, you would use the "Set field value" operation.
Referencing field values inside of your operations
You can use a special format (called Shortcodes) inside of operations value inputs to reference the value of any field of the current entry. This allows for a powerful composition. The format is as follows: {fields.FIELD_NAME.LOCALE}
For example, imagine you had a content type Person with firstName and lastName fields. You now want to add a new field fullName to your content type and merge firstName and lastName into it. After creating a field on your content type, you would open up the app, set up your filters, and create a new "Set field value" operation. You would then use the following as a value of your field: {fields.firstName.en-US} {fields.lastName.en-US}
. This would combine the two field values and form the final value of your new field.
You can learn more about the shortcodes in the Shortcodes documentation .
Publishing your field changes
After the app makes changes to a field of an entry, that entry will have its status set to "CHANGED". The changes are not automatically published to prevent accidental breakages, and so Contentful API will continue serving the old version of an entry. If you want to immediately publish the changes made, add the "Publish entry" operation after all of your other operations.
Running the edit
The editing happens in your browser and so it"s important not to close the tab until the editing completes, otherwise, the editing will not complete. You can still safely work in other tabs and leave the APP tab open in the background.
Before running the edit
The app is powerful so it needs to be used responsibly. It"s easy to make an unintended change which can then be hard to reverse (the app currently does not offer a recovery mechanism). In most cases, you can still revert the changes manually (or with the help of a developer) as Contentful keeps old versions of entries in the primary environment. Given that the app offers the ability to edit a lot of entries at once however, recovery can be a painful process. For this reason I suggest running the app in a separate, non-primary environment, and then using environment aliases to push your changes to production.