You need to sign in to do that
Don't have an account?
![georg georg](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
get Object data type in apex class
Hi All,
Please help me...
For one of my apex class i need to fill out some mandatory fields with dummy data. Actually i want to get the field data type in apex class to fill dummy data. How i can do this.
You can get a field's data type with something like this (I've used an Account field in this example)
Schema.DisplayType dt = Schema.sObjectType.Account.fields.AnnualRevenue.getType();
System.debug('***** Type ' + dt.name() +' *****');
The result here is Currency. Your question was kind of vague so it's possible I missed it's intent. if so feel free to clarify.