function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MMcLeanMMcLean 

Retaining Custom Objects When Converting Lead to Contact

I've created a Custom Object which is linked to a Lead.  When I convert the Lead to a Contact, I'd like the records in the Custom Object to be linked to the Contact record.

I am consuming the SF API in an ASP.NET application written in C#.

Suggestions on how to accomplish this would be welcome.  Thanks, and happy holidays!

benjasikbenjasik
Do you have a lookup to both a contact and a lead on the custom object or would you want the system to create the relationshp on the fly for you? If you already have the relationships, I think you might be able to do one of the following:

Build custom lead convert code to do this.

Poll to find converted leads, find custom objects that were related to the newly converted lead, and then update them to point to the contact.
MMcLeanMMcLean
Hello, Benji.

I thought any objects attached to a Lead are deleted when the Lead is converted. So, even if I were able to find the association between Lead and Contact, wouldn't my original custom object (the one that was attached to the Lead record) have been deleted?

Also, the documentation states that Leads can only be converted via the website. If so, then how can I write custom lead convert code?

Thank you!

Marcia
DevAngelDevAngel

Hi MMcLean,

Can you point out where on the website it mentions that leads can only be converted through the UI so that I can correct that?

leadConvert is new method on the 5.0 api and is documented in our online documentation.

Thanks.

MMcLeanMMcLean
Dave - Good news that this has been added in Version 5: I had an older version of the API documentation (downloaded 11/4/04).

Thanks!

Marcia McLean
benjasikbenjasik
The original custom object is not removed after you convert a lead. Most of the related objects are moved to the account or contact or opportunity.

I just tested this and my custom object still existed after the lead conversion.
MMcLeanMMcLean
Benji - Are you able/willing to share your code?

Thanks,
Marcia
benjasikbenjasik
There was no code in my test.

I did the following

Create custom object X. Create two relationships on the custom object, one to lead, one to contact

Create a lead
Create a new custom object parented to the lead, and some other contact. Copy the URL of this custom object.
Convert the lead

Then view the custom object that was parented to the lead. It will still be there.

There's sample code for the convertLead call in the API docs.
MarciaMacMarciaMac
Hello again Benji,

We want the custom object to continue to be parented to the Lead, even after the Lead is converted, and NOT to another contact. Your suggestion, which is by the way very much appreciated, does preserve the custom object, but does not preserve the original "parent" relationship. Or have I missed something in the implementation?

Thanks,
Marcia
benjasikbenjasik
If you convert a lead using the convertLead call, the custom object is still parented to the lead. However, you cannot view a converted lead in the UI, but you can access it in the API.
MarciaMacMarciaMac
Hello Benji,

Here's what we'd like to do:

- Create a custom object that is attached to a Lead
- Preserve the parented relationship between custom object and Lead after the Lead is converted to a Contact
- Convert Lead to Contact through the UI, NOT through the API: we want the site administrator to retain the ability to convert Leads through the UI
- Have the custom object be viewable in the UI after the Lead is converted to a Contact. The custom object would, at that point, be seen in the Contact web page.

Put another way, we'd like to have a key/foreign key relationship between the custom object and both Lead and Contact records. But we'd like the Contact key to be nullable until the site admin converts the Lead to a Contact (through the UI). When the Lead is converted, we want to update the custom object record with the Contact record ID.

If a custom object won't work, perhaps there is a built-in object in SalesForce we could use to accomplish this?

Thanks!
benjasikbenjasik
So the only way I can think of doing this is have a background program that polls for new contacts. For these new contacts, you query the Lead table to see if there are converted leads associated with these contacts. If so, then you'd find the custom object associated with that lead, and update it to be associated with the contact as well.

There's no process in SFDC that will do this automatically for you. However, note that tasks and events are copied over when leads are converted.
MarciaMacMarciaMac

Benji - Thanks again.

Got another question:  we are setting up a conference call with our mutual customer for 2 pm tomorrow (Tuesday, Eastern Time).  Is there anyone in your group, or perhaps a Customer Success Manager, who might be available to join us?  If that is too short notice, then what is reasonable advance warning for a con call?

We don't want to add or link Custom Objects in a way that would interfere with reporting or other features of your system.

Thank you,

Marcia

benjasikbenjasik
Best to work with the Account Exce or CSM of the SFDC customer for getting someone on a call.

Thanks.
_dj_dj
Instead of polling for new contacts and converted leads (which would just be a periodic batch event), can we attached our own home-grown code so that when the user converts a lead in the GUI, it calls our code? That way, custom objects immediately get propagated from the lead to the new contact. How do we attach this code to the GUI Lead Convert button? Thanks.
DevAngelDevAngel

Hi _dj,

We don't let other people's code run on our servers. So, that is not an option.

_dj_dj

I'm sure you do not want "other people"'s code to be running on your server, but it makes our process very comburesome. There has been lot architectures implemented that allows 'pipeline' processing (injecting code in a business process/pipeline). To allow safe execution, I'm sure you can restrict the other people's code/custom code a.k.a client customization to access ONLY your api.

I've been trying to understand the following concepts/technologies to allow us integrate our process into your system WITHOUT having us hosting our custom component on our server - while I think it could be easily integrated in your pipeline/workflow running on your server:

a. workflow (to define a rule/task to copy the custom object on lead conversion)

b. sforce control (same as above but using client side code running on user's browser)

c. weblink (user clicking on a link at the end of lead conversion - this means hosting the component on our server)

d. lead mapping conversion customization

I hope I'm explaining correctly. Please advise.

 

lrainaldilrainaldi

Has this changed at all, that is having a custom object linked to a Lead and converting the custom object to an account. That the custom object is now linked to the Contact that the lead was converted to?

 

Thanks

BA_AdminBA_Admin

Benji,

     i have similar issue, i have custom object called Marketing Activity which is generated by Eloqua, this object is in related list to lead and we have 2 custom fields where one is lookup to lead and the other is to contact , so when i go to lead and create Marketing activity record and when i convert the lead this record doesn't gets attached to the contact , do i need to write any code for this i thought by default this should get attached to the contact .

 

TIA!