Custom validation rule checking value of referenced object in Sanity.io

1 replies
Last updated: Nov 3, 2020
I'm working on a custom validation rule. The rule needs to check the value of a referenced object using Rule.valueOfField. Is this possible? (Rule.valueOfField returns an object with path: 'name of referenced field' and type: Symbol(FIELD_REF).)
Nov 3, 2020, 8:32 AM
Solved it using the context param accessing the document.
Nov 3, 2020, 8:47 AM

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.

Was this answer helpful?