You need to sign in to do that
Don't have an account?
How can I get the standard object field Name using Apex Class??
Hi all,
i have used the following code to retrieve StandardObjectFields however LookUp fields are missing.. advance thanx for your Suggestions,,
sObject s = new Lead();
Schema.DescribeSObjectResult r = Lead.sObjectType.getDescribe();
Map<String, Schema.SObjectField> M = Schema.SObjectType.Lead.fields.getMap();
LQResults = new List<LeadQueryResults>();
for(Schema.SObjectField sf : M.values())
{
LeadQueryResults myobject = new LeadQueryResults();
myobject.isChecked = false;
myobject.Leadname = sf.getDescribe().Label;
LQResults.Add(myobject);
}
}
Thnx.
These fields aren't missing, they appear as Ids. E.g. ConvertedAccount doesn't exist but ConvertedAccountId does. ConvertedAccount is the relationship but that doesn't actually exist on the sobject if you look at your org via the soql explorer.
All Answers
Can you expand on what you mean by lookup fields aren't present?
When I execute similar code I get lookup fields back for converted opportunity id, created by id etc.
yes,Am also getting those fileds (converted opportunity id, created by id). but the Reqt is to get the complete list of Fields(Labels) of particular Object. Ex: For Lead Obj LookUp fields Like Campaign,LeadOwner,ConvertedAccount,ConvertedContact etc are MISSING..
These fields aren't missing, they appear as Ids. E.g. ConvertedAccount doesn't exist but ConvertedAccountId does. ConvertedAccount is the relationship but that doesn't actually exist on the sobject if you look at your org via the soql explorer.