You need to sign in to do that
Don't have an account?
dipu2
How do we get the field type of a named field?
Is there a shorter way to get the field type of a named field. Field name is given to me. I want to know if it is a reference field.
String fieldName = 'BaseProductId__c'; System.assert(Schema.DisplayType.REFERENCE == Product2.sObjectType.getDescribe().fields.getMap().get(fieldName).getDescribe().getType());
Hi,
We can only use describe sobject to get field data type.i dont think there is another way around.below is the sample code to get field data type in generic.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.