πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

How to Auto Populate References in Parent Document when New Children are Created

1 replies
Last updated: Apr 16, 2020
Hi, i have two documents. One document is a parent and the other is children of the first. In the parent document i want an array with all the referances to the children to be auto populated when new children is created. This is so that the end user can sort the documents in what ever order they see fit but also so that they wont have to manually add all the children manualy. Is this possible and/or is there any other way for the enduser to sort a list in whatever way they want? πŸ™‚
Apr 16, 2020, 7:19 PM
I did something like this. You can use the query listeners: https://www.sanity.io/docs/listening and then do a "patch" https://www.sanity.io/docs/http-patches
Apr 16, 2020, 9:28 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?