You need to sign in to do that
Don't have an account?
Ankit Arora
Fetch SObject.name
Looking for a workaround to fetch name from sObject record like I have
List<Sobject> sObj = Database.Query(dynamicQuery) ; for(SObject obj : sObj) { //I can do this System.debug(' :::::::: ' + obj.Id) ; // Looking to do this System.debug('::::::::::::: ' + obj.Name) ; }
I know the SObject name lets say account but I do not want to type cast mt result like this
List<Sobject> sObj = Database.Query(dynamicQuery) ; for(SObject obj : sObj) { Account acc = (Account)obj ; }
Any help regarding this would be appreciable
Thanks
Ankit Arora
sobj.get('Name')
All Answers
sobj.get('Name')
I am such a stupid...... That really helped me. Thank you so much for the reply.
system.debug(sObj.get('Name'));
am unable to fetch the name of sObject...
Method does not exist or incorrect signature: void get(String) from the type List<SObject>