3

I need the option to convert contacts back to leads, and delete the old contact and account.

Suggested links work only half way - meaning: they create the new lead.

http://boards.developerforce.com/t5/Product-Discussion/Converting-a-Contact-to-a-Lead/td-p/55025

I am using the following link, to create the lead:

https://emea.salesforce.com/00Q/e?name_salutationlea2={!Contact.Salutation}&name_lastlea2={!Contact.LastName}&name_firstlea2={!Contact.FirstName}&lea8={!Contact.Phone}&lea3={!Account.Name}&lea11={!Contact.Email}&lea4={!Contact.Title}&lea16street={!Contact.MailingAddress}&lea16city={!Contact.MailingCity}&lea16state={!Contact.MailingState}&lea16country={!Contact.MailingCountry}&lea16zip={!Contact.MailingPostalCode}&lea9={!Contact.MobilePhone}&lea10={!Contact.Fax}&lea12={!Account.Website}

However, I need to be able and Delete the old Account and Contact.

Any ideas?

1

Unfortunately you can't !! The docs state that once the lead is converted, you cannot delete or update it, but you can query it (so I assume all Lead fields with its values must be available,though I havent tested). Here's the link which explains the above. Check the Converted Leads section.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_lead.htm

So you will have to create a new lead. May be you can have a custom button on Contact say "Convert Back to Lead" and have a logic associated to it in a class instead of passing parameters.

You can query the converted lead and and may be clone it and create a new lead. The query would be something like:

Select Id, and other fields from Lead where ConvertedContactId =: yourContactId and ConvertedOpportunityId =: yourContact.AccountId

Or simply query the contact and account records and their corresponding fields and assign their values to the corresponding Lead fields and create the Lead.

Once you create the new lead, at the end you can delete the contact and account using the ContactId and AccountId fields which you already have as you clicked the button from Contact"s detail page.

| improve this answer | |
0

What I did was:

  1. Create a custom field on lead: From_Account__c

  2. I updated the custom link, to populate the From_Account__c with the Account value from that Contact:

    {!$Site.CurrentSiteUrl}/00Q/e?name_salutationlea2={!Contact.Salutation}&name_lastlea2={!Contact.LastName}&name_firstlea2={!Contact.FirstName}&lea8={!Contact.Phone}&lea3={!Account.Name}&lea11={!Contact.Email}&lea4={!Contact.Title}&lea16street={!Contact.MailingAddress}&lea16city={!Contact.MailingCity}&lea16state={!Contact.MailingState}&lea16country={!Contact.MailingCountry}&lea16zip={!Contact.MailingPostalCode}&lea9={!Contact.MobilePhone}&lea10={!Contact.Fax}&lea12={!Account.Website}&00N4444440dXsY={!Account.Id}

  3. I created an (after insert) trigger, that will delete the account, based on the ID from field: SFSE Q

trigger deleteAccountFromContact on Lead (after insert) {

if (Trigger.new[0].From_Account__c != null)
{

    List<Account> accountsToDelete = new List<Account>();

    Account tempAccount = [Select Id from Account where Id =:Trigger.new[0].From_Account__c];

    accountsToDelete.add( tempAccount ) ;

    delete accountsToDelete;
}

And Voila: we have a "Convert to Lead" from Contact object, that deletes the account and the associated contacts (use with caution!)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.