How AI is powering better personalization in e-commerce [with Vercel]. Sign up now →

initialValue for boolean field not working in Sanity Studio

5 repliesLast updated: Nov 29, 2025

😥Hi, I added an initialValue of a boolean type to true but on the studio, it is not selected to true.
AI Update

I understand the frustration! This is actually expected behavior in Sanity Studio. The initialValue property only applies when a document is first created - it doesn't retroactively apply to existing documents or even to fields in documents that are already open.

Here are the key things to understand:

How initialValue works:

Field-level initialValue in your schema only sets the value when:

If you're testing on an existing document or a document that's already been created, you won't see the initial value applied.

To set a boolean field to true by default:

defineField({
  name: 'approved',
  type: 'boolean',
  initialValue: true
})

This should work, but as documented, you need to:

Common gotchas:

To test it properly:

If you need more complex initialization logic or want to set values based on context (like the current user or parent document), you can use Initial Value Templates in your sanity.config.ts file instead.

Hope this clears things up! Let me know if you're still seeing issues after creating a fresh document.

Show original thread
5 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions