function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SfdcBlueFishSfdcBlueFish 

Field ID ?

Hai friends,

 

         We can get Objectid using getprefix() method,now i need to get field id of an object. Can u please help me?

 

 

Thanks in advance

 

SFDC Bluefish 

Shashikant SharmaShashikant Sharma

I don't thing there is anything like field Id that we have , you can definitly get FieldMap for any Object, using field describe methods. A field map is map of field api name as key and schema.field as value.

 

like this 

 

I don't thing there is anything like field Id that we have , you can definitly get FieldMap for any Object, using field describe methods. A field map is map of field api name as key and schema.field as value.

like this 
// Get the sObject describe result for the Account object

Schema.DescribeSObjectResult r = Account.sObjectType.getDescribe();

// Get the field describe result for the Name field on the Account object

Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.Name;

// Get the sObject describe result for the Account objectSchema.DescribeSObjectResult r = Account.sObjectType.getDescribe();// Get the field describe result for the Name field on the Account objectSchema.DescribeFieldResult f = Schema.sObjectType.Account.fields.Name;

String fieldAPIName = f.getNae();

 

 

SfdcBlueFishSfdcBlueFish

sharma....thanks for reply,

 

           I am getting all for the field except id,what i am thinking is field also have id ,like object id.i have tried describe method for an object ,but i didn't get id of an field in an object. I hope any of our community frieds will help us.

 

 

 Haribabu

 Force.com certified developer

flexandsalesforce.blogspot.com

 

 

 

 

Ankit AroraAnkit Arora

The only way I know is to get it from inspect element !! But I don't think there is any way to get it in apex..

 

Thanks

 

Ankit Arora

 

SfdcBlueFishSfdcBlueFish

 

Ankit,

 

           In inspect element we can get id for that lable,not for that field.any way we can get result,but if salesforce provides any method to get id for filed,then we can implement this trick in many situation dynamically.....i hopw it will provides.

 

 

Thanks for reply ankit.

 

Haribabu

force.com certified developer

flexandsalesforce.blogspot.com