Re: Issue 9 in salesforce-beatbox: Add support for the convertLead operation.

7 views
Skip to first unread message

codesite...@google.com

unread,
Aug 17, 2012, 12:59:07 PM8/17/12
to plo...@googlegroups.com

Comment #1 on issue 9 by j...@optimizely.com: Add support for the
convertLead operation.
http://code.google.com/p/salesforce-beatbox/issues/detail?id=9

I also needed convertLead, and added it with the following changes.

(add to the bottom of _beatbox.py)

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, sendNotificationEmail=False,
overwriteLeadSource=False):
AuthenticatedRequest.__init__(self, serverUrl,
sessionId, "convertLead")
self.__convertedStatus = convertedStatus
self.__leadIds = leadIds;
self.__doNotCreateOpportunity = doNotCreateOpportunity
self.__sendNotificationEmail = sendNotificationEmail
self.__overwriteLeadSource = overwriteLeadSource

def writeBody(self, s):
s.startElement(None, 'leadConverts' )
s.writeStringElement(_partnerNs, "convertedStatus",
self.__convertedStatus)
s.writeStringElement(_partnerNs, "doNotCreateOpportunity",
self.__doNotCreateOpportunity)
s.writeStringElement(_partnerNs, "leadId", self.__leadIds)
s.writeStringElement(_partnerNs, "overwriteLeadSource",
self.__overwriteLeadSource)
s.writeStringElement(_partnerNs, "sendNotificationEmail",
self.__sendNotificationEmail)
s.endElement() # leadConverts


(add to the Client class in _beatbox.py)

def convertLead(self, leadIds, convertedStatus,
doNotCreateOpportunity=False, sendNotificationEmail=False,
overwriteLeadSource=False):
return ConvertLeadRequest(self.__serverUrl, self.sessionId,
leadIds, convertedStatus, doNotCreateOpportunity, sendNotificationEmail,
overwriteLeadSource).post(self.__conn)



Reply all
Reply to author
Forward
0 new messages