function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DEV_CGDEV_CG 

how to cast Schema.SobjectType to String

Hi everyone,

could you please check and help me out
List<case> scope=new List<Case>([select id from case]);
Schema.SObjectType sObjectType = scope.getSObjectType();
String s=(string)sObjectType;
its not working
Best Answer chosen by DEV_CG
Paul S.Paul S.
Try this:
String s = String.valueOf(sObjectType);

 

All Answers

Paul S.Paul S.
Try this:
String s = String.valueOf(sObjectType);

 
This was selected as the best answer
Raj VakatiRaj Vakati
Try this code
 
List<case> scope=new List<Case>([select id from case]);
Schema.SObjectType sObjectType = scope[0].getSObjectType();
SYstem.debug('sObjectType'+sObjectType);

String s=sObjectType.getDescribe().getName();
System.debug('aa'+s);