How do I get the Id of the field on Standard object like Account, Opportunity from Apex? Tooling API helps in getting the Custom Object and Custom Field Id.

Any idea?


The standard salesforce fields have their own standard IDs (names). Here is the list

  • What if I add a custom field on standard object.. I added a custom field and it's Id is 15 character alphanumeric. Right now I have to store the ID of the field in custom setting which is not a elegant solution as the Id will differ between environments. Hence wanted to retrieve the IDs dynamically in code. – get2arpit Dec 4 '14 at 4:14
  • Unfortunately the tooling API doesn't support that scenario at the moment. You can do that with this old hack (if that helps) - force201.wordpress.com/2014/02/27/finding-visualforce-field-ids – Boris Bachovski Dec 4 '14 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.