🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Troubleshooting dropdown fields in Sanity Studio using a script

10 replies
Last updated: Jul 20, 2022
Hello all 🙂I’m in the process of writing content to Sanity Studio using a script to create new documents. So far I have been able to adjust the shape of my data as necessary, and write new documents successfully. That is except for two fields I have which, in my Sanity Studio, are displayed as a dropdown layout choice of two options each. Even though my field names match, and the data appears to be there when I inspect a particular document, it is not visible in the UI and my dropdown remains blank, instead of displaying the data I have written.
Has anyone had any experience with this?
I’m wondering how to get my data appearing in that dropdown field correctly in the studio.
Jul 18, 2022, 1:19 AM
Hi, can you post your document schema? One thing I notice is that your dropdown shows
while your data is
Solo Show
- this will have to match using a predefined list of options with an
{ title: 'Solo', value: 'Solo Show' }
item (see documentation ) or otherwise use
as your data value.
Jul 18, 2022, 7:12 AM
How is your schema defined for these fields? Because looking at it, it seems that the names don’t match between your data and your schema.
Jul 18, 2022, 7:50 AM
Yes, I noticed that I had Solo Show instead of Solo, you’re right that was a mistake. But the other field has the correct options for either External or Gallery, and that field seems to contain data that is not showing.
Jul 18, 2022, 7:52 AM
My schema looks like this:
      name: "location",
      title: "Location",
      type: "string",
      options: {
        list: [
          { title: "Gallery", value: "gallery" },
          { title: "External", value: "external" },
        layout: "dropdown",
      name: "type",
      title: "Type",
      type: "string",
      options: {
        list: [
          { title: "Solo", value: "solo" },
          { title: "Group", value: "group" },
        layout: "dropdown",

Jul 18, 2022, 7:53 AM
Your data values mismatch, they are not lowercased, compared to the list option values (
Jul 18, 2022, 7:55 AM
Right, I was also about to say: be mindful of capitalization. They are 2 different strings.
Jul 18, 2022, 7:56 AM
Ah 🙂 I see, thank you! I will make this change and try again.
Jul 18, 2022, 7:57 AM
AAAaaaand: love to see a tool that logs artist shows in my native Munich! Would you like to share your work with us? I would love to see what you’ve built!
Jul 19, 2022, 1:33 PM
user J
absolutely 🙂 Once I have finished writing a bit more content to the studio I would be happy to share. I’ll update you back in this thread in the next week or so. And hi from Berlin!
Jul 19, 2022, 8:53 PM
Hello back from Berlin ;)
Jul 20, 2022, 12:24 AM

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?