Get data from a custom type in a slice

Hi guys,

Really enjoying learning Prismic recently which I am using with NextJS. I really need some help though.

I have a custom type called Testimonials. This has a group field with starRating, review and customerName.

On my homepage custom type I have a slice called testimonials where I want to display the data inside the Testimonials custom type but I can't get this to work.

How can I get the data to pull through? I have read the docs but can't get things to work. I believe I need to use a content relationship field which I set up but the json data is not pulling through the data.

Hello @studio120barberingz glad to hear you're enjoying using Prismic!

You need to pull the data from the document. Here's the documentation for this: Template Content in Next.js - Prismic

If you want you can share your query code snippets if you need help building your queries.

1 Like

Thanks. I think I managed to do it as it added the content relationship to the homepage custom type as well as to the slice. Not sure if I could get it somehow on a slice without having it as a field on the custom type the slice is on.

The Content Relationship field is the solution for pulling data from another doc. You can add it inside or outside of Slices.