Get column data type - Example 1
Sat May 04 2024 19:53:59 GMT+0000 (Coordinated Universal Time)
Saved by
@saloni_naik
String objType='Contact';
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(objType);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
List<String> shagni = new List<String>();
for (String fieldName: fieldMap.keySet()) {
Schema.DisplayType fielddataType = fieldMap.get(fieldName).getDescribe().getType();
System.debug(fielddataType);
}
content_copyCOPY
Comments