【问题标题】:simple-salesforce not recognizing custom objectsimple-salesforce 无法识别自定义对象
【发布时间】:2016-07-04 13:44:30
【问题描述】:

我正在使用 simple_salesforce 并获取名为“SER__Condition__c”的自定义对象的所有记录。我知道这是这个名字,因为我从管理员那里得到了一个表名列表。
“api”是“simple_salesforce.Salesforce”的一个实例。
这是我正在执行的命令:

pprint(api.query('SELECT Id FROM SER__Condition__c'))

返回此错误:

  File "path\to\lib\simple_salesforce\api.py", line 698, in _exception_handler
    raise exc_cls(result.url, result.status_code, name, response_content)
simple_salesforce.api.SalesforceMalformedRequest: Malformed request https://xxx.salesforce.com/services/data/v29.0/query/?q=SELECT+Id+FROM+SER__Condition__c. Response content: [{'message': "\nSELECT Id FROM SER__Condition__c\n
       ^\nERROR at Row:1:Column:16\nsObject type 'SER__Condition__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.", 'errorCode': 'INVALID_TYPE'}]

对默认对象使用完全相同的命令会按预期返回所有记录:

pprint(api.query('SELECT Id FROM Account'))

这两个也一样:

api.Account.get('xxxxxxxxxxxxxxxxxx')
api.SER__Condition__c.get('xxxxxxxxxxxxxxxx')

【问题讨论】:

    标签: python python-3.x salesforce soql simple-salesforce


    【解决方案1】:

    这可能是权限问题。确保运行查询的用户可以看到 SER__Condition__c 对象。

    【讨论】:

      【解决方案2】:

      我 90% 确定问题出在对象的名称上。对于 Salesforce,自定义对象的命名约定不能包含两个连续的下划线。来自有关对象创建的 Salesforce 错误消息:“错误:对象名称字段只能包含下划线和字母数字字符。它必须是唯一的,以字母开头,不包含空格,不以下划线结尾,并且不包含两个连续的下划线。”

      如果您将“SER__Condition__c”更改为“SER_Condition__c”(“SER”和“Contition”之间的一个下划线),它应该可以解决问题。

      【讨论】:

      • SER 和其他名称之间的双下划线表示 SER 是一个包命名空间。我不认为这是错误的原因。
      【解决方案3】:

      是的,我通过编辑用户配置文件的自定义对象权限解决了这个问题。看起来它默认为无。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-08-27
        • 2016-01-30
        • 2012-08-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多