[英]How to get the tabs information in a salesforce account using REST API in python?
I have a Salesforce
developer account where I have some bunch of tabs like below我有一个Salesforce
开发人员帐户,其中有一些如下所示的选项卡
I am using simple_salesforce
library and I can access information of each tab just fine.我正在使用simple_salesforce
库,我可以很好地访问每个选项卡的信息。 For example If I need some information of Contacts
tab, I make a query like so例如,如果我需要Contacts
选项卡的一些信息,我会像这样进行查询
import requests
from simple_salesforce import Salesforce, SalesforceLogin
# Create the connection
session_id, instance = SalesforceLogin(username='abcdr@email.com', password='abcd',
security_token = 'Kds43Ddsd44DDSdsds4')
sf = Salesforce(instance=instance, session_id=session_id)
# Query to execute
sql_query = "SELECT name, Email FROM Contact WHERE LastName = 'Chen'"
information = sf.query_all(query= sql_query)
print(information)
Now there is something I do not understand.现在有一点我不明白。 As you can see in the picture, the tab names are plural.正如您在图片中看到的,选项卡名称是复数形式。 But while querying, I have to provide singular name.但是在查询时,我必须提供单数名称。 So If I want to query something in Contacts
tab, in my query I do FROM contact
or If I want to query something from Leads tab, I do FROM Lead
.因此,如果我想在“ Contacts
选项卡中查询某些内容,在我的查询中我会执行FROM contact
或者如果我想从“潜在客户”选项卡中查询某些内容,我会执行FROM Lead
。
I do not quite understand why do I have to write in such a way.我不太明白我为什么要这样写。 So to be sure, I would rather get the tabs information and then query on them.所以可以肯定的是,我宁愿获取标签信息,然后查询它们。 But I can't find how to get the list of tabs like Home, Chatter, Accounts etc. There is something called describeTabs()
but nothing I could find for simple_salesforce
library or any query that can get me the tabs information.但是我找不到如何获取诸如主页、Chatter、帐户等选项卡列表。有一个叫做describeTabs()
东西,但我找不到simple_salesforce
库或任何可以获取选项卡信息的查询。
How do I get the tabs information?如何获取标签信息?
When you run query in Salesforce in such way当您以这种方式在 Salesforce 中运行查询时
SELECT name, Email FROM Contact WHERE LastName = 'Chen'
You query records of a database table Contact
(in salesforce terms table is a sObject) and Tab
is just a view for sObjects.您查询数据库表Contact
记录(在 salesforce 术语中表是一个 sObject),而Tab
只是 sObjects 的一个视图。 Usually you do not need to work with tabs in you code at all.通常,您根本不需要在代码中使用选项卡。
There's a set of standard objects like Account
, Contact
, Opportunity
and custom object which you can define, custom objects(tables) has a __c
postfix有一组标准对象,如Account
、 Contact
、 Opportunity
和您可以定义的自定义对象,自定义对象(表)有一个__c
后缀
You can read more about this here您可以在此处阅读有关此内容的更多信息
List of standard objects 标准对象列表
The set of objects which available for you in org might differ based on Salesforce edition (Developer, Enterprise, etc) and platform version Sales Cloud, Service Cloud, Marketing Cloud, etc您在组织中可用的对象集可能因 Salesforce 版本(开发人员、企业等)和平台版本 Sales Cloud、Service Cloud、Marketing Cloud 等而异
You can open setup and view a standard objects here您可以在此处打开设置并查看标准对象
Custom objects and tabs自定义对象和选项卡
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.