You need to sign in to do that
Don't have an account?
Gaurav Agnihotri
Schema Class : how to display all the text fields in an object
Hello,
I am trying to explore different possiblity from Schema class. I beleive this class is a good resource for all programmers.
I am trying to display text fields of a custom object. The script below gives me all the fields
public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Map <String, Schema.SObjectField> fieldMap = schemaMap.get('Account').getDescribe().fields.getMap();
system.debug(fieldMap);
How can i get the field property so that i can filter all text fields?
I am trying to explore different possiblity from Schema class. I beleive this class is a good resource for all programmers.
I am trying to display text fields of a custom object. The script below gives me all the fields
public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Map <String, Schema.SObjectField> fieldMap = schemaMap.get('Account').getDescribe().fields.getMap();
system.debug(fieldMap);
How can i get the field property so that i can filter all text fields?
I'm not sure if the below link will help but I use it when I would like to get full details of fields on any object.
http://schemalister.herokuapp.com/
Thansk,
Synthia
Please find the code below. Hope this helps. It included both field text as well as textarea.
[If you got answer from my post please mark it as solution.]
Thanks,
Kapil
(forcecube@gmail.com)
1) https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm
2) http://blog.jeffdouglas.com/2011/10/20/getting-salesforce-field-metadata-the-easy-way/
3) https://developer.salesforce.com/forums/?id=906F000000091p2IAA
You can access the field type in the sae way that you access the label - just use the getType method. E.g.
Try below code
Then call above code like below
Let us know if this will help you