How to create a sub queries working three collections ? How to add reference fields whenever form submisson ?

Hi
i have three collections ,and then i am creating a reference fields in showcast collection. taken from these two reference fileds are one in castroles collection and another one is peoples collection.

Hi,
You can use insertReference () method for form submissions.

To query referenced items, please see the instructions here .

Hi
thank you
but its not working i alredy tried