【问题标题】:SalesForce - Is there a way to download all fields from a "contacts" list without admin privileges?SalesForce - 有没有办法在没有管理员权限的情况下从“联系人”列表中下载所有字段?
【发布时间】:2018-05-22 21:56:49
【问题描述】:

基本情况

我目前可以访问包含 5000 多个联系人列表的销售人员页面。但是,该页面一次只能加载 25 个联系人,并且无法复制和粘贴。单击联系人还会提供其他有用的详细信息,但一般列表是最重要的。我无权访问管理门户;我只能查看联系人等特定内容。

链接结构如下:https://example.force.com/example/_ui/search/ui/UnifiedSearchResults?offset=25&fpg=1cjmlvhdxsqly&str=epsilon-mu&sen=&fen=003&initialViewMode=detail&relatedListId=Contact&aId=_1527023282480&cookieParam=cookieParam1527023882485&tyme=1527023282485

我的观点

问题

是否有方法(例如 python、bash 脚本、url 编辑、网页抓取等)下载列表(作为 .cvs 或 .txt)或将列表完整填充以进行简单复制并粘贴?

【问题讨论】:

  • 我尝试将“initialViewMode=”的 url 字段编辑为等于“summary”,但这只会使列表无法通过修改“显示更多”按钮进行扩展。控制台出现错误是“Uncaught TypeError: Cannot read property 'keyPrefix' of undefined at b.successCallBackDrilldown......”等。

标签: python excel bash web-scraping salesforce


【解决方案1】:

为了将整个表格导入 Excel,我运行了这个脚本。您将需要添加您的登录详细信息和表名。

import csv
from simple_salesforce import Salesforce


"""
Downloading the table
"""
# Logging in to SF and creating object
sf = Salesforce(
    password='{{password}}', username='{{uName}}', 
    security_token='{{token}}',
    client_id='TestingApp')

# Getting the field names
tableInfo = sf.{{tableName}}.describe()
tableFields = []
for x in tableInfo['fields']:
    tableFields.append(x['name'])
hdrs = ', '.join(tableFields)

output = sf.query_all("SELECT " + hdrs + " FROM {{tableName}}")

headline = []
for key in output['records'][0]:
    headline.append(key)


with open('C:\\temp\\Table.csv', 'w', newline='', encoding='utf-8') as csvfile:
    writer = csv.DictWriter(csvfile, fieldnames = headline)
    writer.writeheader()
    for record in output['records']:
        writer.writerow(record)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多