• toddmcgrath
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies

Hello,

 

I'm trying to convert a Lead to an _existing_ Person Account using convertLead.

 

Any ideas on what

 

cannot associate a contact with a consumer account

 

 means?  According to docs, I should set contactId to null which I'm doing.

 

 

public LeadConvertResult[] convertLead (ID leadId, ID contactId, ID accountId, boolean overWriteLeadSource, boolean doNotCreateOpportunity, String opportunityName, String convertedStatus, boolean sendEmailToOwner, ID ownerId) {

LeadConvert leadConvert = new LeadConvert();

// set to null when converting to an existing person account
leadConvert.setContactId(null);

leadConvert.setOwnerId(ownerId)
leadConvert.setAccountId(accountId);

leadConvert.setLeadId(leadId);
leadConvert.setOverwriteLeadSource(overWriteLeadSource);
leadConvert.setDoNotCreateOpportunity(doNotCreateOpportunity);
leadConvert.setOpportunityName(opportunityName);
leadConvert.setConvertedStatus(convertedStatus);
leadConvert.setSendNotificationEmail(sendEmailToOwner);
ConvertLead convertLead = new ConvertLead()

convertLead.setLeadConverts([leadConvert] as LeadConvert[])

ConvertLeadResponse response = serviceStub.convertLead(convertLead, sessionHeader, null, null,null,null )
LeadConvertResult[] lcr = response.getResult()
//lcr is returning "cannot associate a contact with a consumer account" error
return lcr

}

 

 

When code calls convertLead with a Account/Contact combo everything works _fine_, so I'm having issues with convertLead and Person Accounts only.   

 

Shouldn't this be working?  

 

Any ideas, suggestions, greatly appreciated.

 

Todd

 

 

 

Message Edited by toddmcgrath on 10-01-2009 03:33 PM
Message Edited by toddmcgrath on 10-01-2009 04:06 PM

Hello,

 

Does convertLead work with an existing Person Account?

 

 

void testConvertLeadFromStudentAccount() { // use test lead created via Browser def lead = salesForceService.getAllObjects(Lead.class, "Email = 'testonly@na.com'")[0] assertNotNull("should have returned lead", lead) def first = "StudentAPIFirst" def last = "StudentAPILast" println "creating person account" Account acct = new Account() acct.name = '' def studentaccount = getRecordTypes().find { it.name =='Student Account' } println "stud id: ${studentaccount.id}" acct.recordTypeId = studentaccount.id acct.ownerId = salesforce_owner_id acct.gender__pc = '' acct.languages__pc = '' acct.firstName = first acct.lastName = last acct.salutation = '' acct.level__pc = '' acct.personEmail = 'testonly@na.com' SaveResult[] result = salesForceService.createObjects(acct) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "ERROR: ${er.getMessage()}" } assertTrue("should have created account", it.success) println "Account ID: ${it.id}" acct.id = it.id } println("lead id: ${lead.id}") LeadConvertResult[] convResult = salesForceService.convertLead(lead.id, '', acct.id, false, false, "opp name", 'Closed - Converted', false, salesforce_owner_id) convResult.each { LeadConvertResult it -> it.errors.each { com.sforce.soap.partner.Error er -> println "ERROR: ${er.getMessage()}" } assertTrue("should have converted lead", it.success) } }

 

Code is sending the person account.id and '' for the contact.id to the convertLead code.

 

Error returned is:

cannot associate a contact with a consumer account

 

any ideas?  suggestions?

 

 

Hello,

 

I'd like to create a new Person Account via API.  I have Person Account enabled.  Ideally, I want to create a Person Account in one shot, but I don't think it's possible?  I need to create an Account and 1 associated Contact and then convert the account to a Person Account type?  

 

 

void testCreateAndDestroyStudentAccount() { def first = "APIFirst" def last = "APILast" // create new, non-person Account first Account acct = new Account() acct.name = "${last}" def organizationaccount = getRecordTypes().find { it.name =='Educational Organization' } acct.recordTypeId = organizationaccount.id acct.ownerId = salesforce_owner_id acct.gender__pc = '' acct.languages__pc = '' acct.firstName = '' acct.lastName = '' acct.salutation = '' acct.level__pc = '' SaveResult[] result = salesForceService.createObjects(acct) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "ERROR: ${er.getMessage()}" } assertTrue("should have created account", it.success) println "Account ID: ${it.id}" acct.id = it.id } println "creating contact..." Contact contact = new Contact() contact.setFirstName(first) contact.setLastName(last) contact.accountId = acct.id contact.recordTypeId = '' contact.ownerId = salesforce_owner_id result = salesForceService.createObjects(contact) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "Create contact ERROR: ${er.getMessage()}" } assertTrue("should have created contact", it.success) println "CONTACT ID: ${it.id}" contact.id = it.id } def studentaccount = getRecordTypes().find { it.name =='Student Account' } acct.recordTypeId = studentaccount.id result = salesForceService.updateObjects(acct) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "Update Account ERROR: ${er.getMessage()}" } fail("should have converted to Person Account") } }

 

Code creates an Account and Contact fine, but fails at the update when attempting to convert to a Person Account (at the end) with message:

 

Cannot specify any additional fields when marrying or separating a Person-Account

 

 

 

Ideas?  Thoughts? Suggestions?

 

I appreciate any insight

 

Todd

Hello,

 

I'm trying to convert a Lead to an _existing_ Person Account using convertLead.

 

Any ideas on what

 

cannot associate a contact with a consumer account

 

 means?  According to docs, I should set contactId to null which I'm doing.

 

 

public LeadConvertResult[] convertLead (ID leadId, ID contactId, ID accountId, boolean overWriteLeadSource, boolean doNotCreateOpportunity, String opportunityName, String convertedStatus, boolean sendEmailToOwner, ID ownerId) {

LeadConvert leadConvert = new LeadConvert();

// set to null when converting to an existing person account
leadConvert.setContactId(null);

leadConvert.setOwnerId(ownerId)
leadConvert.setAccountId(accountId);

leadConvert.setLeadId(leadId);
leadConvert.setOverwriteLeadSource(overWriteLeadSource);
leadConvert.setDoNotCreateOpportunity(doNotCreateOpportunity);
leadConvert.setOpportunityName(opportunityName);
leadConvert.setConvertedStatus(convertedStatus);
leadConvert.setSendNotificationEmail(sendEmailToOwner);
ConvertLead convertLead = new ConvertLead()

convertLead.setLeadConverts([leadConvert] as LeadConvert[])

ConvertLeadResponse response = serviceStub.convertLead(convertLead, sessionHeader, null, null,null,null )
LeadConvertResult[] lcr = response.getResult()
//lcr is returning "cannot associate a contact with a consumer account" error
return lcr

}

 

 

When code calls convertLead with a Account/Contact combo everything works _fine_, so I'm having issues with convertLead and Person Accounts only.   

 

Shouldn't this be working?  

 

Any ideas, suggestions, greatly appreciated.

 

Todd

 

 

 

Message Edited by toddmcgrath on 10-01-2009 03:33 PM
Message Edited by toddmcgrath on 10-01-2009 04:06 PM

Hello,

 

Does convertLead work with an existing Person Account?

 

 

void testConvertLeadFromStudentAccount() { // use test lead created via Browser def lead = salesForceService.getAllObjects(Lead.class, "Email = 'testonly@na.com'")[0] assertNotNull("should have returned lead", lead) def first = "StudentAPIFirst" def last = "StudentAPILast" println "creating person account" Account acct = new Account() acct.name = '' def studentaccount = getRecordTypes().find { it.name =='Student Account' } println "stud id: ${studentaccount.id}" acct.recordTypeId = studentaccount.id acct.ownerId = salesforce_owner_id acct.gender__pc = '' acct.languages__pc = '' acct.firstName = first acct.lastName = last acct.salutation = '' acct.level__pc = '' acct.personEmail = 'testonly@na.com' SaveResult[] result = salesForceService.createObjects(acct) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "ERROR: ${er.getMessage()}" } assertTrue("should have created account", it.success) println "Account ID: ${it.id}" acct.id = it.id } println("lead id: ${lead.id}") LeadConvertResult[] convResult = salesForceService.convertLead(lead.id, '', acct.id, false, false, "opp name", 'Closed - Converted', false, salesforce_owner_id) convResult.each { LeadConvertResult it -> it.errors.each { com.sforce.soap.partner.Error er -> println "ERROR: ${er.getMessage()}" } assertTrue("should have converted lead", it.success) } }

 

Code is sending the person account.id and '' for the contact.id to the convertLead code.

 

Error returned is:

cannot associate a contact with a consumer account

 

any ideas?  suggestions?

 

 

Hello,

 

I'd like to create a new Person Account via API.  I have Person Account enabled.  Ideally, I want to create a Person Account in one shot, but I don't think it's possible?  I need to create an Account and 1 associated Contact and then convert the account to a Person Account type?  

 

 

void testCreateAndDestroyStudentAccount() { def first = "APIFirst" def last = "APILast" // create new, non-person Account first Account acct = new Account() acct.name = "${last}" def organizationaccount = getRecordTypes().find { it.name =='Educational Organization' } acct.recordTypeId = organizationaccount.id acct.ownerId = salesforce_owner_id acct.gender__pc = '' acct.languages__pc = '' acct.firstName = '' acct.lastName = '' acct.salutation = '' acct.level__pc = '' SaveResult[] result = salesForceService.createObjects(acct) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "ERROR: ${er.getMessage()}" } assertTrue("should have created account", it.success) println "Account ID: ${it.id}" acct.id = it.id } println "creating contact..." Contact contact = new Contact() contact.setFirstName(first) contact.setLastName(last) contact.accountId = acct.id contact.recordTypeId = '' contact.ownerId = salesforce_owner_id result = salesForceService.createObjects(contact) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "Create contact ERROR: ${er.getMessage()}" } assertTrue("should have created contact", it.success) println "CONTACT ID: ${it.id}" contact.id = it.id } def studentaccount = getRecordTypes().find { it.name =='Student Account' } acct.recordTypeId = studentaccount.id result = salesForceService.updateObjects(acct) result.each { it.errors.each { com.sforce.soap.partner.Error er -> println "Update Account ERROR: ${er.getMessage()}" } fail("should have converted to Person Account") } }

 

Code creates an Account and Contact fine, but fails at the update when attempting to convert to a Person Account (at the end) with message:

 

Cannot specify any additional fields when marrying or separating a Person-Account

 

 

 

Ideas?  Thoughts? Suggestions?

 

I appreciate any insight

 

Todd

Could someone point me in the right direction/provide advice for converting a lead to a person account?

Thank you in advance.