Using Schema.DisplayType we are able to fetch the field type i.e RTF. can anyone help me how to fetch the value present in that field.

String type='case';
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType schemaTyp = schemaMap.get(type);
Map<String, Schema.SObjectField> fieldMap = schemaTyp.getDescribe().fields.getMap();      
Schema.DisplayType myType=fieldMap.get('RichTextField__c').getDescribe().getType();

You named example of working with metadata. Data, that describes data.

to get value of a field for concrete record, use SOQL query:

Id caseId = 'some known case id';
Case selectedCase = [
    select Id, RichTextField__c
    from Case
    where Id =:caseId
    limit 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.