👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Setting initialValue of a Boolean Type to True

5 replies
Last updated: Aug 18, 2021
😥Hi, I added an initialValue of a boolean type to true but on the studio, it is not selected to true.
Aug 18, 2021, 3:21 PM
initialValue
will only be applied to newly created document, is the document you’re editing a new one?
Aug 18, 2021, 3:58 PM
No
Aug 18, 2021, 4:24 PM
I just created a new comment by myself and it wasn't checked. By default, it's supposed to be approved then if I see any spam then I can disapprove it.
Aug 18, 2021, 5:53 PM
To add a bit more context to
user G
’s comment:
Initial Value Templates allow you to define templates for the values of a new document’s fields. These values are only applied when you create a new document in the Studio – the values are not retroactively applied to existing documents or when documents are created from the client libraries.
user Q
, to confirm, you’re not getting the
approved
boolean set to
true
when you create a new document?
Aug 18, 2021, 6:45 PM
user M
Yes, by default I want it to be approved whenever someone creates a new comment.
Aug 18, 2021, 7:09 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?