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.
Clone this repository, then run:
yarn install
Or if you prefer to use npm, you can run:
npm install
Finally run:
yarn start
Or
npm 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 yarn start
successful,
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.