You need to sign in to do that
Don't have an account?

Creating List object from string
Having an issue creating a List object from a string value. The selectedObject value is coming over as a string value. Trying to convert the string value so that it can be used as the object in a list or a Map
Class
Util
error is : Invalid type: selectedStringSobject
Class
private Sobject selectedStringSobject; selectedObject = 'CustomObject__c' selectedStringSobject =Util.getSobjectFromString(selectedObject); List<selectedStringSobject> newrecords = new List<selectedStringSobject>()
Util
public static SObject getSobjectFromString(String stringObject) { Map<String, Schema.SObjectType> obj = Schema.getGlobalDescribe(); Schema.SObjectType so = obj.get(stringObject); Sobject newObject = so.newSobject(); return newObject; }
error is : Invalid type: selectedStringSobject
Try this way:
All Answers
Try this way: