CMS Data
CMS Data action allows you to fetch and retrieve data from Webflow CMS collections within your workflows. This action is designed for reading CMS content and making it available to subsequent actions in your workflow. It can also delete CMS items, for example items whose source record was removed.
Overview

The CMS Data action connects to your Webflow site's CMS collections and retrieves items based on your configuration. Unlike CMS Data Sync which creates and updates items in Webflow, this action is focused on reading and consuming CMS content, and on deleting items you select.
Configuration
Site Selection
The action automatically uses your connected Webflow site. Ensure you have proper permissions to access the CMS collections you want to read from.
Collection Settings
Collection: Select the CMS collection you want to fetch data from. The dropdown will show all available collections in your connected Webflow site.
Live Publish:
Enabled - Fetches data from your live, published site
Disabled - Fetches data from your staging/draft site

Choose based on whether you need the most current published content or if you're working with draft content.
Data Expression
The Expression field allows you to write JavaScript code that processes the retrieved CMS data. Within this expression, you have access to:
items- Array of CMS collection itemsctx- Context object from previous actionsslug()- Utility function to create URL-safe slugsdeleteItems()- Deletes CMS items when the workflow completes, see Deleting CMS Items
Working with CMS Data
Accessing Collection Items
CMS collection items are available in the items variable within your expression:
Data Structure
Each item in the items array has the following structure:
Expression Examples
Here are common patterns for working with CMS data:
Accessing Field Data
CMS fields are accessible via the fieldData object. The available fields depend on your specific CMS collection structure:
Note: The actual field names depend on your CMS collection structure. Common fields include name, slug, dateCreated, and dateUpdated, but your collection may have different field names.
Using the Slug Utility
The slug() function creates URL-safe slugs from text:
Deleting CMS Items
Call deleteItems() to delete items from the selected collection. It takes a CMS item, a Webflow item ID (item.id), or an array of them:
The items are deleted when the workflow completes, after CMS Data Sync actions have created and updated their items. If the workflow fails, nothing is deleted.
Deleting Items Removed From the Source
A common use is deleting items whose record was removed from the API you sync from. For example, GoodHabitz lists removed content at https://api.goodhabitz.com/v2/deleted-contents:
These are GoodHabitz IDs, not Webflow item IDs, so match them against the CMS field that stores the GoodHabitz ID, the same field your CMS Data Sync action matches items by:
Add an HTTP paginated action that fetches
deleted-contents, with the result variabledeleted.Add a CMS Data action inside the HTTP paginated action, so it runs for every fetched page, and select the synced collection.
Use this expression, replacing
goodhabitz-idwith the slug of your ID field:
ctx.deleted.data is the response body, so ctx.deleted.data.data is its list of removed content.
How Items Are Deleted
Only items in the collection are deleted. IDs that don't match an item in
itemsare skipped, and the logs show a warning listing them. With Live publish enabled,itemsholds only published items.Each item is deleted once, even when
deleteItems()is called several times or the action runs in a loop.Live publish: when enabled, published items are removed from the live site right away. When disabled, they stay on the live site until you publish it.
Logs: the action logs how many items will be deleted, and the workflow run statistics show how many were deleted.
Deleted items can't be restored. Before calling deleteItems(), log what your filter selects and check the logs of a run:
Use Cases
Populating Reference Fields
The primary use case for CMS Data action is populating reference and multi-reference fields in other CMS collections:
Content Aggregation
Data Validation
Dynamic Workflows
Reporting
Data Transformation
Best Practices
Performance Optimization
Filter early: Apply filters to reduce data processing
Limit results: Use
.slice()to work with smaller datasets when possibleAvoid deep processing: Keep complex operations minimal for large collections
Data Handling
Check for existence: Always verify fields exist before accessing them
Handle empty collections: Check
items.length > 0before processingPreserve original data: Store original items if you need them later
Context Management
Error Handling
Common Issues and Solutions
Empty Results
Missing Fields
Type Safety
Expression Requirements
Your expression must:
Process the
itemsarray as neededStore results in the
ctxobject for next actionsNot explicitly return anything (the system returns
{ ctx: ctx }automatically). Areturnends the expression early and keeps thectxchanges and the items passed todeleteItems()so far.
The processed context data will be available to all subsequent actions in your workflow.
Last updated