我正试图通过salesforce Beatbox python客户端向上插入一条记录upsert操作似乎很好,但我不太清楚如何将externalid指定为外键:
尝试使用以下内容进行追加插入:
consolidatedToInsert = []
for id,ce in ConsolidatedEbills.items():
consolidatedToInsert.append(
{
'type':'consolidated_ebill__c',
'Account__r':{'type':'Account','ETL_Natural_Key__c':ce['CLASS_REFERENCE']},
'ETL_Natural_Key__c':ce['ISSUE_UNIQUE_ID']
}
)
print consolidatedToInsert[0]
pc.login('USERNAME', 'TOTALLYREALPASSWORD')
ret = pc.upsert('ETL_Natural_Key__c',consolidatedToInsert[0])
print ret
给出错误:
'The external foreign key reference does not reference a valid entity: Account__r'
[{'isCreated': False, 'errors': [{'fields': [], 'message': 'The external foreign key reference does not reference a valid entity: Account__r', 'statusCode': 'INVALID_FIEL D'}], 'id': '', 'success': False, 'created': False}]
soap示例和错误文本的特殊性似乎表明了这是可能的,但我在文档中几乎找不到关于使用外部id插入的内容。在
仔细看一下,我不确定这是否可能,一个完全损坏的Account-ur密钥似乎在悄无声息地传递,好像它甚至不是XML翻译的目标,但我还是希望错了。在
很快就换成pythonclient.py422点0分:
^{pr2}$还有一个__beatbox.py375:0分
for fn in sObjects.keys():
if (fn != 'type'):
if (isinstance(sObjects[fn],dict)):
self.writeSObjects(s, sObjects[fn], fn)
else:
s.writeStringElement(_sobjectNs, fn, sObjects[fn])
它就像某种黑暗魔法。在
目前Beatbox不支持序列化这样的嵌套字典,这是您尝试执行的外部化解析所必需的。(如果查看生成的请求,可以看到嵌套字典只是作为字符串序列化的)。在
相关问题 更多 >
编程相关推荐