我正在使用SalesForce“Beatbox”库(http://code.google.com/p/salesforce-beatbox/source/browse/trunk/src/beatbox/_beatbox.py)
异常1:当我刚发送leadId时,我得到异常“INVALID_CROSS_REFERENCE_KEY:valid leadId is required”
这是说我没有使用有效的leadId,但我发誓这是一个有效的leadId,因为我事先做了一个检索leadId,并从SalesForce自己获取了leadId!在
例外情况2: 当我取消对convertedStatus和doNotCreateOpportunity参数的注释时,我得到了异常“soapenv:客户端错误:元素{urn:partner.soap.sforce.com}doNotCreateOpportunity在此位置无效“
这意味着我向SalesforceAPI传递参数的方式有问题。但在我看来是对的。在
有什么办法解决这些问题吗?在
def convertLead(self, leadIds, convertedStatus, doNotCreateOpportunity=False):
return ConvertLeadRequest(self.__serverUrl, self.sessionId, leadIds, convertedStatus, doNotCreateOpportunity).post(self.__conn)
class ConvertLeadRequest(AuthenticatedRequest):
"""
Converts a Lead to an Account. See also:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_convertlead.htm
"""
def __init__(self, serverUrl, sessionId, leadIds, convertedStatus, doNotCreateOpportunity=False):
AuthenticatedRequest.__init__(self, serverUrl, sessionId, "convertLead")
self.__convertedStatus = convertedStatus
self.__leadIds = leadIds;
self.__doNotCreateOpportunity = doNotCreateOpportunity
def writeBody(self, s):
#s.writeStringElement(_partnerNs, "convertedStatus", self.__convertedStatus)
#s.writeStringElement(_partnerNs, "doNotCreateOpportunity", self.__doNotCreateOpportunity)
s.writeStringElement(_partnerNs, "leadId", self.__leadIds)
编辑:
现在,当我提出以下要求时:
^{pr2}$我仍然得到异常“转换状态无效”
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Element {urn:partner.soap.sforce.com}convertedStatus invalid at this location</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
问题是writeBody没有生成正确的结构。检查WSDL显示convertLead调用需要这些结构中的0..n个。(例外情况2是关于这一点的提示)
所以你的书写本需要像
^{pr2}$如果要进行批量潜在客户转换,则需要为要执行的每个潜在客户转换生成此结构的多个实例。
相关问题 更多 >
编程相关推荐