Using Type in the APEX SALESFORCE

SNIPPET:



        // Use Class Name for defining the Type
        Type t = Type.forName('CLASS_NAME');
        
        // Now creating a instance using TYPE
        CLASS_NAME instance = (CLASS_NAME)Type.forName('CLASS_NAME').newInstance();
        
        //Verify the Instance
        System.debug('***' + instance);

Comments