FavoriteDeveloper Forums User (Inactive) (Salesforce Developer Forums) asked in #ApexMay 21, 2020, 10:24 PMI have a SOQL Query in String form and i want to get the Object name on which the query is running. How can i do so?Example : String str = ' SELECT Name,Id FROM Account LIMIT 10';Now i want to retrieve "Account" from this query for further use.2 answersSortSort by DateSort by Most HelpfulSort by DateLoad more comments...agustin blanco (Salesforce)May 21, 2020, 11:02 PMhi, you can use the id you get from the query and get the object name:String objectName = objectId.getSobjectType().getDescribe().getName();if it helps please mark as correct, it may help othersAdd a commentWrite an answer...BoldItalicUnderlineStrikethroughBulleted ListNumbered ListAdd linkCode blockInsert imageAttach filesLink URLCancelSave0/9000Reply
agustin blanco (Salesforce)May 21, 2020, 11:02 PMhi, you can use the id you get from the query and get the object name:String objectName = objectId.getSobjectType().getDescribe().getName();if it helps please mark as correct, it may help others