You need to sign in to do that
Don't have an account?
N>Help Error: Compile Error: expecting right curly bracket, found 'for' at line 8 column 7
here is my code...
public class objectlist {
//Do not forget to get instance in constructor for this list
//String type='Account';
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
List<string> fieldLable = new List<string>();
Map <String, Schema.SObjectField> fieldMap = gd.get('Account').getDescribe().fields.getMap();
for(Schema.SObjectField fieldAPI : fieldMap.values())
{
fieldLable.add(+ '<' +fieldAPI.getDescribe().getName()+ '/>' );
}
system.debug('fieldLable-----'+fieldLable);
}
IDK what part is wrong...pls help me fix this...THX!!!
public class objectlist {
//Do not forget to get instance in constructor for this list
//String type='Account';
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
List<string> fieldLable = new List<string>();
Map <String, Schema.SObjectField> fieldMap = gd.get('Account').getDescribe().fields.getMap();
for(Schema.SObjectField fieldAPI : fieldMap.values())
{
fieldLable.add(+ '<' +fieldAPI.getDescribe().getName()+ '/>' );
}
system.debug('fieldLable-----'+fieldLable);
}
IDK what part is wrong...pls help me fix this...THX!!!
All Answers
Try this following link which may be helpfull to you.
http://forceschool.blogspot.in/2011/06/dynamic-binding-when-object-name-is.html
Thanks,
Shiva.
Public class classname{
public void methodname{
------------code---------
}
}
Note :same code will be working in developer console.
just call the sort() method on your list
this is a sample page , do necessary modifications according to your requirment
I was wondering what do I change to retrieve the Field Label instead of Field API Name...
refer this for all available methods in fields
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_fields_describe.htm#apex_methods_system_fields_describe