Skip to content
See Sanity in action 👀 Join us for a live product demo + Q&A →
Sanity
Get started
  • Sanity Studio - Flexible editing environment
  • Content Lake - Real-time database
  • Developer experience - Tooling you love
  • Structured content - The philosophy behind Sanity
  • Review changes - View edits & rollback instantly
  • Image pipeline - On-demand transformations
  • E-commerce - Better shopping experiences
  • Marketing sites - Control your story
  • Products & services - Innovate and automate
  • Mobile apps - Content backend for every OS
  • Aether - Unique digital shopping experience
  • Morning Brew - Omnichannel media distribution
  • InVision - Delivering exceptional customer experiences
  • DataStax - Personalization for global audience
  • React
  • Gatsby
  • Next
  • Nuxt
  • Eleventy
  • Netlify
  • Vercel
  • Algolia
  • Documentation
  • Reference
  • Guides
  • Resource library
  • Headless CMS
  • Tools & plugins
  • Project showcase
  • Schemas & snippets
  • Agency partners
  • Technology partners
  • Get support
  • Share your work
  • 5 Disadvantages Of Wordpress That Are Holding You Back
EnterprisePricing
Contact salesLog inGet started
Published February 24th 2020

Releasing Document Actions: Workflows, Your Way

Define custom workflow actions in Sanity Studio. Override the publish button, and adapt your content management system to fit how you work, instead of the other way around.

Even Eidsten Westvang

Even is a Sanity.io co-founder and product person

With the latest release of the Sanity Studio, we have introduced three new concepts for the Sanity Studio: Document actions, Document badges, and Studio React Hooks. You can use them to build bespoke workflows. Learn how to quickly build your own simple workflow in this guide, or go to the reference documentation to learn the nitty-gritty implementation details.

// Post a link to this document in our review channel in Slack
export function NotifyInSlackAction(props) { 
  return {
    label: 'Post in #review',
    onHandle: () => {
      notifyInSlack()
      props.onComplete()
    }    
  } 
}

With the new Document actions, you can do stuff like:

  • Build custom approval processes
  • Trigger custom asynchronous integrations from the actions bar
  • Add additional form steps before publishing
  • Define your own action badges
  • Use React hooks for common document operations, like publish and validation

A core idea behind Sanity is that the product adapts to how you want to work, not the other way around. That’s why we don’t want to shoehorn you and your team into generic catch-all workflows. A company of 1.000+ necessarily has different constraints than a team of 5 when it comes to keeping content velocity.

npm i -g @sanity/cli && sanity upgrade

Demo: Review Workflow

Go to the demo’s GitHub repository

We really wanted to show how the new document actions API could be used so we built a demo for it as well. With the new “review workflow” demo you can:

  • Assign documents to project users
  • Push document review state from the action bar
  • Do these operations in a kanban/swimlane view

The workflow demo doesn’t have a formal security model and anyone can change any document to any state. Sure, you can use custom access control to add server-side rules if you need to limit who can do what, but all good companies already operate on trust.

So unless you’re bound by legal requirements you can most often just use trust to let people follow the workflow that makes the most sense for them. This saves you the hassle and avoids bottlenecks.

You can’t trust blindly though and sometimes you need to verify. To allow you to do that Sanity has full document history where you can travel back to previous edit sessions to see what the document looked like then.

Platform

Structured ContentDeveloper experienceContent LakeSanity StudioSecurity & Compliance
  • Sanity vs Contentful
  • Sanity vs Strapi
  • Sanity vs Wordpress
  • Sanity vs Adobe Experience Manager
  • Sanity vs Hygraph
  • Sanity vs Sitecore
  • Sanity vs Storyblok
  • Sanity vs Contentstack
  • Sanity vs Prismic
  • Sanity vs Drupal
  • Sanity vs ButterCMS

Resources

Documentation
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Progressive Web Application
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
Resource library
  • Agency partners
  • Technology partners
  • Blog Template
  • Personal Website Template
  • Developer Portfolio Templates
  • All Templates
Case Studies
  • Headless CMS
  • What is an API CMS
  • Static Sites 101
  • Headless SEO
  • Localization
  • GraphQL vs REST
  • What is a DXP?
  • Typescript 101
  • Content as a Service
  • Ecommerce SEO
  • React CMS
  • Next.JS CMS
  • CMS for Shopify
  • Content platform
  • Multilingual CMS
  • Static Site CMS
  • Gatsby CMS
  • Node CMS
  • E-commerce CMS
  • Vue CMS
  • Angular CMS
  • GraphQL CMS
  • Newspaper CMS
  • Magazine CMS
  • CMS for apps
  • Remix CMS

Company

Contact SalesEnterpriseCareersTerms of ServiceAccessibility Statement

Stay connected

  • GitHub
  • Slack
  • Twitter
  • YouTube
  • Stack Overflow
  • Blog RSS
  • Newsletter
©Sanity 2023