CustomSelector on Components

Hi, there!
I’m using a Custom Selector inside a part. Actually, this input type calls the service defined in the input config based on the current content. That’s ok, but it stucks in using inside components, since the url called is not component-based, so in case we have a customizable part where I need to read what the user have picked in another inputs, we can’t run portalLib.getComponent();

Here’s an example:
I have a content with path “/site/content” with a CustomSelector input. When clicking to pick an element on this input, it calls the service url: http://[host]/admin/portal/edit/draft/[content.path]//service/my.app/workingSelectorService?ids=%5B%5D&count=10
In this case, the returned elements are based on another input value of this content, so I can use a simple “portalLib.getContent()” and get this value, so I can build the query using it and return the elements.

BUT

In this same content, I have a part with a CustomSelector and the service called should be component-based, because I need inputs set on this component to fetch the hits I will return, but I can’t run the getComponent() because the url is not component-based and I can’t run a getContent and then loop through the page components because I can have more components of this type with another config and I don’t know which index/path is calling the service.

There’s a solution to that or it could/should be a new feature?

1 Like

This sounds like an “avantgarde” way of using customSelectors. I guess we did not think of this usecase :slight_smile:

However, it sounds only reasonable you should be in component context when editing the part config. Let’s see if this is a quickfix :slight_smile:

1 Like

I think it will not be a quickfix because to reach this you will need to enable component-based services too. I checked urls like “//component/[region]/[component-index]//service/[app.name]/myservice” and they seem to be not mapped yet :smile_cat:

You are indeed right…

2 Likes