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
Marc Romeu BelMarc Romeu Bel 

Retreive lead conversion map from Apex code

Hi fellow developers!
Is there any way to retrive the Lead conversion map from apex code?
I mean the standard feature that can be configured from the Lead custom fields section:
User-added image
Thanks for your help!!
Hi Marc,

Standard Salesforce Functionality, converts lead and create three records out of it:
  1. Account (Parent Object)
  2. Opportunity (Child to Account)
  3. Contact (Child to Account). 
Opportunity and Contact are sibling objects. 

Can you please elaborate, what exactly you required so that I would provide you better solution on this. 

Skype: gaurav62990 
Marc Romeu BelMarc Romeu Bel
Hi Gaurav, I want to access the fields map to develop custom functionality. Let's say that we have created the custom field "Potential users" in Lead and the custom field "Estimated licenses" in Opportunity. Then we have mapped the fields using the standard functionality. I would like to know if the map that connects lead fields with other objects fields is available to retrieve from Apex code. Best
Hi Marc,

There are two appraoches, i.e. if we need to go up in Hierarchy:
Schema.DescribeFieldResult f = Schema.sObjectType.Order_Line_Item__c.fields.Order__c;

Or, if we need to drill down:
for(Schema.ChildRelationship cr : Order__c.SObjectType.getDescribe().getChildRelationships()){
    System.debug(cr.getChildSObject() + '.' + cr.getField() + ' reversed is: ' + cr.getRelationshipName());

Hope this helps!!!



Marc Romeu BelMarc Romeu Bel
Hi Gaurav,

I don't see how your answers relate to my question. Can you explain your point?
Hi Marc,

In my above solution, I have provided two scenario's. 
  1. If we need to retrieve Field Mapping from Child object Parent object. 
  2. If we need to retrieve field Mapping from Parent to child object. 
In the scenario you explained above, it Lead to opportunity i.e. Parent to Child. 

Hope it explains..

Gabriel WondersGabriel Wonders
Hi Marc,

There is no way to access the Lead conversion mapping within Apex. :( I created a new Salesforce success idea for this feature.