Setting up schema with references to filter categories by project in Sanity.io
Last updated: Jul 6, 2020
Hi! I’m trying to set up a schema where a particular data type has references to two other data types, “projects” and “categories”. The category data type also has a reference to a “project”. What I’d like to do is to apply a filter to my reference to (type: “category”) that only shows categories that have a reference to the same project I’ve already selected. This: https://www.sanity.io/docs/reference-type#additional-dynamic-filter-8118f73f6758 – seems close to what I want to do, but I can’t figure out how to modify it to work with references. Thanks!
Jul 6, 2020, 5:27 AM
Hi Dan, something like this should work. In the example I’ve assumed that the category type has a reference field called