You need to sign in to do that
Don't have an account?
rajafu
Problem while Fetching list of fields for a custom object
Hi All, I am trying to fetch the list of fields for a custom object.. below is the code
String fieldNames = Field_Details.getFieldDetails('Inspection_Checklist__c');
my object definition is as
Singular Label -- Inspection Checklist
Plural Label -- Inspection Checklist
Object Name -- Inspection_Checklist
API Name -- Inspection_Checklist__c
I tried passing all possible values but it not returning anything. same code iis working for another Custom Object... Am i missing any thing.. please help
Thanks
String fieldNames = Field_Details.getFieldDetails('Inspection_Checklist__c');
my object definition is as
Singular Label -- Inspection Checklist
Plural Label -- Inspection Checklist
Object Name -- Inspection_Checklist
API Name -- Inspection_Checklist__c
I tried passing all possible values but it not returning anything. same code iis working for another Custom Object... Am i missing any thing.. please help
Thanks
Can you post the code of getFieldDetails? That will help to solve this problem.
You can try this way.
String fieldValues = '';
SObjectType objectType = Schema.getGlobalDescribe().get(Inspection_Checklist__c);
DescribeSObjectResult objDesc = objectType.getDescribe();
Map<String, SObjectField> fields = objDesc.fields.getMap();
Set<String> fieldSet = fields.keySet();
for(String f : fieldSet)
{
fieldValues += f +',';
}
if(fieldValues.endsWith(','))
fieldValues= fieldValues.substring(0,fieldValues.length()-1);
return fieldValues;
Mark this as solution if you got the answer.
Thanks.
Praveen Murugesan