• Allie Cichocki 4
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

 

 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