I have an issue where I am trying to render a component on a VF page where I don't know if the component exists in the org or not until run time (I am trying to use a dynamic component on the front end). Since I can't assume it exists by default, I can't reference the component like so:
Component.some_namespace.MyComponent myComp = new Component.some_namespace.MyComponent();
as that won't compile.
I can query the component using SOQL and even get its markup, but can I do anything with the VF markup I get? Could I create a wrapper component and inject the markup somehow? I guess like...
Component.c.WrapperComponent wrapComp = new Component.c.WrapperComponent();
wrapComp.vfMarkup = queriedComponent.Markup;
it's frustrating because the queried component is of type ApexComponent
(a metadata type) but the dynamic component requires an object of type ApexPages.Component
. There's no way I can convert the ApexComponent
to a ApexPages.Component
, right?