function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CarlBCarlB 

Dynamically creating component in apex

Hi,

In Apex it is now possible to create an instance of a Visualforce component using:
     Component.c.MyCustomComponent myDy = new Component.c.MyCustomComponent();

It is also possible to instantiate an instance of a class using:
    Type t = Type.forName('XXXXX');
    t.newInstance();

I was wondering if there was any way to combine these two, as Type.forName('Component.c.MyCustomComponent') returns null.

Thanks,

Carl

George NguyenGeorge Nguyen
Unfortunately no. It is quite disappointing that they have not implemented this feature. These two combined will make it extremely flexible and useful in a gazillion of cases. 

:O(