Search code examples
pythonpython-2.7salesforcebeatbox

Python, Beatbox - Return all available fields


I'm trying to run a query into Salesforce that returns the names and API names of all the fields with an associated object using beatbox.

Has anyone done this before? Is it possible?

Thanks


Solution

  • There's an example of that in demo.py that comes with Beatbox,

        desc = svc.describeSObjects("Account")
        for f in desc[sf.fields:]:
            print "\t" + str(f[sf.name])
    

    will print all the API names of the fields on Account, if you want the labels as well, that'd be str(f[sf.label])