0

我正在尝试在 Salesforce 中运行一个查询,该查询返回所有字段的名称和 API 名称以及使用 beatbox 的关联对象。

有没有人这样做过?是否可以?

谢谢

4

3 回答 3

2

Beatbox 附带的 demo.py 中有一个例子,

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

将打印 Account 上字段的所有 API 名称,如果您还想要标签,那就是 str(f[sf.label])

于 2014-05-17T15:37:58.147 回答
0

接受的答案导致此错误:“TypeError: slice indices must be integers or None or have an index method”

这有效:

import beatbox

api = beatbox.PythonClient()  
api.login(sf_username, sf_pw+sf_token)
obj_desc = api.describeSObjects("Order")[0]
names = [name for name in obj_desc.fields]
于 2016-01-26T09:49:39.513 回答
0

对我来说,这就像一个魅力:)

我遇到了同样的错误:得到“TypeError:切片索引必须是整数或无或有索引方法”

我很容易得到所有可用的字段、标签、数据类型:`

import beatbox
api = beatbox.PythonClient()  
api.login(sf_username, sf_pw+sf_token)
fields = api.describeSObjects("Account")[0].fields
all_table_list = [ {'name':key[1].name,'label':key[1].label,'type':key[1].type} for key  in fields.iteritems()]

`

于 2016-11-29T14:02:53.337 回答