Contentful logo

Contentful Community

Sidebar UI Extension space.GetEntry not Available?

Hi all,
I have a doubt that I am not clear in the documentation. Is it possible to get linked Entry resolved from a sidebar UI Extension?I’m trying to solve it with extension.space.getEntry () but it returns “undefined”.

Example :slight_smile:

"window.contentfulExtension.init(function(extension) {

let a =  extension.space.getEntry(extension.ids.entry); 

-ETC-
"
Regards!

Hi @v-mbenedit! Welcome!

extension.space.getEntry will return a promise, so you need to use a format like so:

extension.space.getEntry.then(entry => {
    //do something with entry
}) 

Also, if you are trying to get the current entry’s sys.id you can do that with entry.getSys().sys.id

You can find lots of examples to help guide you here.

Hope this helps!