I am trying to get the character limit for a long text area. So for example I have a custom field called –> My_Text_area__c which has the char limit set as 5000.
So how can I get this value in my apex code. I am using this code to get all the long text area fields –>
Schema.SObjectField field = MapofField.get(fieldName);
Schema.DescribeFieldResult F = field.getDescribe();
if(F.getType() == Schema.DisplayType.TextArea && !field.getDescribe().isFilterable()){
// get value here and do some logic
}
Best Answer
getLength()
method ofSchema.DescribeFieldResult
returns the length.For ex.,
prints