Another Salesforce blog!!!

Salesforce, Apex

Instantiating an SObject Dynamically at Run-time


So how would you create a Generic SObject at run-time?

String sObjectName = 'MyObject__c';
Schema.SObjectType t = Schema.getGlobalDescribe().get(sObjectName);
SObject s = t.newSObject();

Leave a Reply

Your email address will not be published.

*