//Setting String str as Contact
String str = 'Contact';
//Casting String to sObject
sObject objc = Schema.getGlobalDescribe().get(str).newSObject();
objc.put('LastName', 'Test');
objc.put('AssistantName', 'Testing');
objc.put('Department', 'Testing');
system.debug('objc is ' + objc);
Output:
No comments:
Post a Comment