You need to sign in to do that
Don't have an account?
Cases to Contacts
I'm trying to map "Cases" when I convert a Lead to a Contact. I have a Lookup field on the Cases object for Leads, so I know they're able to be attached. However, I need to create some code that will keep the Case attached to the Lead when the Lead converts to a Contact. Right now, the Case isn't attaching to the newly converted Contact.
^ Here is my code
^ Here is the error I receive
Does anybody have a solution for this?
The query should be use Contact.Id instead of Contact. Let me know if this helps. Thanks.
List<Case> Cserecords = new List<Case>();
try{
// system.debug('---leadContIdMap------'+leadContIdMap);
Cserecords = [Select Id,Contact.id,Lead__c from Case where Lead__c IN :leadContIdMap.keySet() ];
//system.debug('------surveysList size-----'+splrecords.size());
}catch(QueryException ex){}
for(Case Cse :Cserecords){
// system.debug('------Lead__c-----'+sp.Lead__c);
Cse.Contact.id = leadContIdMap.get(Cse.Lead__c);
//System.debug('------Contact__c-----'+sp.Contact__c);
//p.Lead__c = null;
}
if(Cserecords!=null && Cserecords.size() >0)
update CseRecords;