This simple script helps you de-reference all reference/multi-reference fields in given webflow collections after which you can easily delete bulk items from them.
Deleting webflow collection items that have reference/multi-reference fields is a nightmare. When Items in a collection are referencing an item in another collection or is being referenced by an item in another collection, You can only delete the item after these references are de-referenced.
This simple script helps you de-reference all reference/multi-reference fields in given webflow collections after which you can easily delete bulk items from these collections.
Always back up your Webflow site before running this tool. This script makes bulk changes to your CMS data that cannot be automatically undone. A backup ensures you can restore your content if something goes wrong.
- Clone this repository,
- Open the repository folder in a code editor like VS Code.
- then run:
npm install
Or if you prefer to use yarn, you can run:
yarn install- Run:
npm start
Or
yarn start
First, get an API key for your Webflow site.
- Go to your Webflow Dashboard.
- Click the three dots on the desired Webflow site.
- Click "Settings".
- Click "Apps & Integrations".
- Click "Generate API Token". (Important: make sure to pick the v2 API token, the blue button).
- Under the "Generate API Token" dialog, give a name and grant "read and write" permissions for CMS & Sites.
- Click "Generate Token"
- Copy the API token and store it somewhere safe for later.
Get the Collection Ids of the collection to be de-referenced.
- In your webflow designer, Open your CMS Panel
- Open the Collection settings of the collection and copy the collection id.
- Copy the collection ids of all the collections you want to de-reference and store it somewhere for later.
After the tool is running successfully,
Input the API Key where it says:
Enter your Webflow API token:
Then, Input the collection ids in a comma seperated fashion:
Enter your Webflow collection IDs (comma separated):
It can be one or more collections.
Hit Enter
Sit back and relax while the script processes each collection and de-references the items in them.
After de-referencing is complete, you can go into each collection and delete items 100 by 100 at a time if you want. And publish your site in the designer. This is very easier and time saving.
- Fixed crashes on large collections by adding automatic rate limit handling.
- Handle de-referencing items in different cms locales.
- Batch update of collection items instead of individual item update
- Add devlog.md
Twitter - https://x.com/harikshore15, Email - harikshoresridharan@gmail.com