1

I'm trying to write a UI extension for Experience Space, which gets the ID of an image from a third-party service, converts it into an ECL uri and inserts a multimedia link to this (stub) item.

When I call the setValue method with this ECL uri (a string) as a parameter, I'm getting this error when I try to save the component:

Invalid cast from 'System.String' to 'Sdl.Tridion.ContentManager.OpenApi.Dto.Link'

So I guess I need to construct some sort of Link object and pass that as parameter to setValue. But I cannot figure out how to do that.

By the way: I was able to create an extension of the classic UI in the same way. I found out that as long as the UI passes a correct ECL URI as a value, Tridion will create the stub and construct the link. I hope the same is true for Experience Space.

1
  • Indeed, Core Service REST is "ECL-aware", meaning you can provide ECL URIs instead of TCM URIs. If a CM Stub is needed under the hood, it will be created automatically. And, indeed, a link property has to be of type Link. Unfortunately, my knowledge of the XS frontend it too limited to explain how you can do that. Commented Oct 7 at 7:51

1 Answer 1

1

You are correct, you need a Link object instead of just a string (ECL URI) as a value. Link object looks like this:

interface Link {
  $type: 'Link';
  IdRef: string;
  Title?: string;
}

So, most probably you need to call setValue({ $type: 'Link', IdRef: 'ecl:ecl_uri_example' })

Let me know if it works, otherwise I will try to come up with real example.

1
  • That was it, thanks!
    – Quirijn
    Commented Oct 9 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.