0

When you use salesforce data that has being exported through any API, tables you get have column names in their "API_Name" format. This differs a bit from their "Filed Label" format in which they are presented on salesforce's web UI (for example on reports).

You can find what API name corresponds to any of the columns (objects) in the salesforce object manager.

My question is: is there anywhere a dictionary to map API Names back to their Filed Labels? It will be very helpful to have in JSON or anything that can be used programmatically.

euh
  • 319
  • 2
  • 11

1 Answers1

1

It's called "describe" data. It's available for whole object (label, plural label), fields (label, picklist value translations), names of related lists.

In Apex this is a good initial reading: https://developer.salesforce.com/docs/atlas.en-us.200.0.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm and for fields: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_fields_describe.htm

If you're using REST API - make GET to /services/data/v55.0/sobjects/Account/describe for example.


Have a look at https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_quick_start.htm too. For example if you need to build your own UI for "dependent picklists" it can be painful to read it all from "describe", https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_features_records_dependent_picklist.htm is bit better. And when you fetch records via this API you get fields as object with visible label and raw value (useful when displaying dates, numbers for example)

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • Thank you that is helpful. I am starting to look into this. Although, since I am not the one who makes data migrations via salesforce API I am not used to call any of it. Rather I am just using already exported data in python. Is there a way I could describe API_Names for column names without having to call salesforce API myself ? – euh Nov 10 '22 at 13:39
  • 1
    Python has https://pypi.org/project/simple-salesforce/ package and it offers some describe capabilities. But if you prefer to view this all as tables - yes, there are tables for this metadata too. Check one of my other answers about "FieldDefinition" table? https://stackoverflow.com/a/60067076/313628 except you'd need to query the Label field too. – eyescream Nov 10 '22 at 14:36
  • wow, that's awesome, thanks a lot for all the materials! I will dig into that:) – euh Nov 10 '22 at 20:06