Contentful logo

Contentful Community

Get linked entries in Entries extension

I’m creating a UI Extension for field type “Entries”. On initialization I fetch the links with field.getValue(), although this only gives me the links. What would be the recommended way to resolve the actual entries?

Hi @kristoffer,

Would you be able to provide us the actual snippet of code that you’re using for this?

Here’s the script: https://glitch.com/edit/#!/upbeat-windscreen?path=script.js:20:2

On line 20: “var references = api.field.getValue() || [];” I get the field value but this only gives me the link objects. I would like to have the actual entries in the references variable instead.

I can’t seem to find any real documentation or samples around working with the “Entries” field type in UI Extensions. Can you please point me to where it is?

1 Like

I have the same issue here. Would appreciate some help.

The Extension SDK exposes a method space.getEntry() that takes the entry’s ID as a parameter. You have to extract the ID from the link object and then call space.getEntry() with said ID. This will return the full entry, allowing you to generate a preview to display.