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
souvik9086souvik9086 

CONVERTED LEAD MIGRATION

Hello everyone,

 

We have migrated leads from one salesforce org to another org  through dataloader. Presently some of those leads become converted in source org but those are unconverted in target org. Now the requirement is we have to update those leads which became converted in source to target org so that it will become converted in target org as well.

 

But the problem is when we are going to upload that csv file containing those CONVERTED fields it is not showing for mapping in the dataloader. So eventually it is not becoming converted and remains as unconverted even after update. 

 

Can anyone please help us through this how to enable those fields to display in dataloader for mapping.

 

Thanks in Advance

krprkrpr

You have to write a trigger that converts the Lead  something like this : 

 

if (Trigger.isUpdate || Trigger.isInsert) {
final List<Database.LeadConvert> leadsToConvert = new List<Database.LeadConvert>();
for (Lead ld : trigger.new) {
if (!ld.IsConverted) {
//Mass Lead conversion - opnly convert Leads where COmpany and COntact are explicitly specified
if (ld.Ready_For_Conversion__c && null != ld.AccountId
&& (Trigger.IsInsert || false == Trigger.oldMap.get(ld.Id).Ready_For_Conversion__c)) {
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(ld.Id);
lc.setConvertedStatus(leadStatusByRecordType);
lc.setOverwriteLeadSource(false);
lc.setDoNotCreateOpportunity(true);
lc.setAccountId(ld.AccountId);
leadsToConvert.add(lc);
}
}
}
if (!leadsToConvert.isEmpty()) {
Database.LeadConvertResult[] lcrs =Database.convertLead(leadsToConvert, false);
Integer i=0;
for (Database.LeadConvertResult lcr : lcrs) {
System.assert(lcr.isSuccess(), lcr + '###' + leadsToConvert[i]);
i++;
}
}
}