2016-07-04 62 views
1

我正在使用simple_salesforce并获取名为“SER__Condition__c”的自定义对象的所有记录。我知道这是一个事实,因为我从我们的管理员处获得了一个表名列表。
“api”是“simple_salesforce.Salesforce”的一个实例。
这是我执行命令:simple-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') 

回答

1

它可能是一个权限问题。确保SER__Condition__c对象对于正在运行查询的用户可见。

1

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

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