+ Start a Discussion
bittu myanabittu myana 

hi all how to get account related all fields api names and their values for each field in apex

Andy PutraAndy Putra
what is ur purpose?
bittu myanabittu myana
i want to custamize the lead mapping using metadata inoredr to achive that functionality all the account api names and its values i have to iterate.
Sagarika RoutSagarika Rout
Hi 

By using developer console you can get all the field API name by defining the object name with DOT notation also dynamicly you can use Schema.SObjectType to get the object field dynamically

Map<String,Schema.SObjectField> AccFields = Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap();


Thanks ,
Sagarika
bittu myanabittu myana
Hi Sagarika Rout ,
how can i get field values for that particular api name field.
Sagarika RoutSagarika Rout
Throuhg SOQL querry you can get field value from database base on field API name

Select ID, name,email__c from Account limit 1 ;

Where ID , name , email__c specifies the field API name.
bittu myanabittu myana
Hi,Sagarika Rout
i want the values like this Map<fieldname,value>
in the above map i want the value of associated field