+ Start a Discussion
tgganeshtgganesh 

Creating new Class Instance

Hi All,

 

I have written a trigger on an object. I have written a logic to collect values from a custom setting.

 

In Custom Setting we are storing name of few classes.

 

So i will be receiving class name as value, I have to create instance of the class am receiving from the custom setting.

 

Please help me :(

 

Thanks in Advance..!!

sambasamba

Hi Ganesh,

 

I guess you want to get some datas from the custom setting. Right?

 

List<Test__c> test = Test__c.getAll().values();

 

If this post solves your problem please mask it as solution.

 

 

Thanks,

Samba

tgganeshtgganesh
Hi Samba,

My problem is creating class instance.
sambasamba

You can try System.Type class.

 

Type t = Type.forName('A');

 

A testA = (A)t.newInstance();

 

Hope this helps.

 

Thanks,

Samba