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 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?