示例#1
0
 def convert_leads(self, lead_converts):
     preparedLeadConverts = _prepareSObjects(lead_converts)
     if isinstance( preparedLeadConverts, dict ):
         del preparedLeadConverts['fieldsToNull']
     else:
         for preppedConvert in preparedLeadConverts:
             del preppedConvert['fieldsToNull']
     res = BaseClient.convertLeads(self, preparedLeadConverts)
     if type(res) not in (TupleType, ListType):
         res = [res]
     data = list()
     for resu in res:
         d = dict()
         data.append(d)
         d['success'] = success = _bool(resu[_tPartnerNS.success])
         if not success:
             d['errors'] = [_extractError(e)
                            for e in resu[_tPartnerNS.errors:]]
         else:
             d['errors'] = list()
             d['account_id'] = str(resu[_tPartnerNS.accountId])
             d['contact_id'] = str(resu[_tPartnerNS.contactId])
             d['lead_id'] = str(resu[_tPartnerNS.leadId])
             d['opportunity_id'] = str(resu[_tPartnerNS.opportunityId])
     return data
示例#2
0
 def convert_leads(self, lead_converts):
     preparedLeadConverts = _prepareSObjects(lead_converts)
     del preparedLeadConverts['fieldsToNull']
     res = BaseClient.convertLeads(self, preparedLeadConverts)
     if type(res) not in (TupleType, ListType):
         res = [res]
     data = list()
     for resu in res:
         d = dict()
         data.append(d)
         d['success'] = success = _bool(resu[_tPartnerNS.success])
         if not success:
             d['errors'] = [_extractError(e)
                            for e in resu[_tPartnerNS.errors,]]
         else:
             d['errors'] = list()
             d['account_id'] = str(resu[_tPartnerNS.accountId])
             d['contact_id'] = str(resu[_tPartnerNS.contactId])
             d['lead_id'] = str(resu[_tPartnerNS.leadId])
             d['opportunity_id'] = str(resu[_tPartnerNS.opportunityId])
     return data