Skip to main content
improved formatting and readability, fix tags
Link
Dave Humm
  • 5.1k
  • 5
  • 25
  • 38

I couldntcouldn't merge the custom sobject recordsSObject records. ItsIt shows an error like Specified type Candidate__c cannot be merged

Specified type Candidate__c cannot be merged

My Code is : // Account creation code

List<Candidate__c> newCandidateList = new List<Candidate__c>();
Candidate__c c1= new Candidate__c();
c1.Years_of_experience__c = 4;
c1.Last_Name__c = 'Oracle';
c1.First_Name__c = 'Inc.';
newCandidateList.add(c1);
Candidate__c c2= new Candidate__c();
c2.Years_of_experience__c = 14;
c2.Last_Name__c = 'Oracle Inc';
c2.First_Name__c = 'Inc.';
newCandidateList.add(c2);
Candidate__c c3= new Candidate__c();
c3.Years_of_experience__c = 24;
c3.Last_Name__c = 'Oracle Inc';
c3.First_Name__c = 'India';
newCandidateList.add(c3);
insert newCandidateList;
system.debug('Insert List are :' + newCandidateList);

// Merging code

Candidate__c childrecords = [SELECT Id, Name, First_Name__c, Last_Name__c, Years_of_experience__c FROM Candidate__c WHERE First_Name__c = 'Inc.' LIMIT 1];
system.debug('Retrieved Child Records are :' +childrecords);
Candidate__c masterecord = [SELECT Id, Name, First_Name__c, Last_Name__c, Years_of_experience__c FROM Candidate__c WHERE First_Name__c = 'India' LIMIT 1];
system.debug('Master Records :' + masterecord);
try{
merge masterecord childrecords;
} catch (Exception de){
system.debug('Error during merging the records :' + de.getMessage());
}

// Account creation code

List<Candidate__c> newCandidateList = new List<Candidate__c>();
Candidate__c c1 = new Candidate__c();
c1.Years_of_experience__c = 4;
c1.Last_Name__c = 'Oracle';
c1.First_Name__c = 'Inc.';
newCandidateList.add(c1);

Candidate__c c2 = new Candidate__c();
c2.Years_of_experience__c = 14;
c2.Last_Name__c = 'Oracle Inc';
c2.First_Name__c = 'Inc.';
newCandidateList.add(c2);

Candidate__c c3 = new Candidate__c();
c3.Years_of_experience__c = 24;
c3.Last_Name__c = 'Oracle Inc';
c3.First_Name__c = 'India';
newCandidateList.add(c3);

insert newCandidateList;
system.debug('Insert List are :' + newCandidateList);


// Merging code
Candidate__c childrecords = [
        SELECT Id,
          Name,
          First_Name__c,
          Last_Name__c,
          Years_of_experience__c
        FROM Candidate__c
        WHERE First_Name__c = 'Inc.'
        LIMIT 1];
system.debug('Retrieved Child Records are :' +childrecords);

Candidate__c masterecord = [
        SELECT Id,
        Name,
        First_Name__c,
        Last_Name__c,
        Years_of_experience__c
        FROM Candidate__c
        WHERE First_Name__c = 'India'
        LIMIT 1];
system.debug('Master Records :' + masterecord);

try{
    merge masterecord childrecords;    
} catch (Exception de){
    system.debug('Error during merging the records :' + de.getMessage());
}

I couldnt merge the custom sobject records records. Its shows error like Specified type Candidate__c cannot be merged

My Code is : // Account creation code

List<Candidate__c> newCandidateList = new List<Candidate__c>();
Candidate__c c1= new Candidate__c();
c1.Years_of_experience__c = 4;
c1.Last_Name__c = 'Oracle';
c1.First_Name__c = 'Inc.';
newCandidateList.add(c1);
Candidate__c c2= new Candidate__c();
c2.Years_of_experience__c = 14;
c2.Last_Name__c = 'Oracle Inc';
c2.First_Name__c = 'Inc.';
newCandidateList.add(c2);
Candidate__c c3= new Candidate__c();
c3.Years_of_experience__c = 24;
c3.Last_Name__c = 'Oracle Inc';
c3.First_Name__c = 'India';
newCandidateList.add(c3);
insert newCandidateList;
system.debug('Insert List are :' + newCandidateList);

// Merging code

Candidate__c childrecords = [SELECT Id, Name, First_Name__c, Last_Name__c, Years_of_experience__c FROM Candidate__c WHERE First_Name__c = 'Inc.' LIMIT 1];
system.debug('Retrieved Child Records are :' +childrecords);
Candidate__c masterecord = [SELECT Id, Name, First_Name__c, Last_Name__c, Years_of_experience__c FROM Candidate__c WHERE First_Name__c = 'India' LIMIT 1];
system.debug('Master Records :' + masterecord);
try{
merge masterecord childrecords;
} catch (Exception de){
system.debug('Error during merging the records :' + de.getMessage());
}

I couldn't merge the custom SObject records. It shows an error like

Specified type Candidate__c cannot be merged

My Code is :

// Account creation code

List<Candidate__c> newCandidateList = new List<Candidate__c>();
Candidate__c c1 = new Candidate__c();
c1.Years_of_experience__c = 4;
c1.Last_Name__c = 'Oracle';
c1.First_Name__c = 'Inc.';
newCandidateList.add(c1);

Candidate__c c2 = new Candidate__c();
c2.Years_of_experience__c = 14;
c2.Last_Name__c = 'Oracle Inc';
c2.First_Name__c = 'Inc.';
newCandidateList.add(c2);

Candidate__c c3 = new Candidate__c();
c3.Years_of_experience__c = 24;
c3.Last_Name__c = 'Oracle Inc';
c3.First_Name__c = 'India';
newCandidateList.add(c3);

insert newCandidateList;
system.debug('Insert List are :' + newCandidateList);


// Merging code
Candidate__c childrecords = [
        SELECT Id,
          Name,
          First_Name__c,
          Last_Name__c,
          Years_of_experience__c
        FROM Candidate__c
        WHERE First_Name__c = 'Inc.'
        LIMIT 1];
system.debug('Retrieved Child Records are :' +childrecords);

Candidate__c masterecord = [
        SELECT Id,
        Name,
        First_Name__c,
        Last_Name__c,
        Years_of_experience__c
        FROM Candidate__c
        WHERE First_Name__c = 'India'
        LIMIT 1];
system.debug('Master Records :' + masterecord);

try{
    merge masterecord childrecords;    
} catch (Exception de){
    system.debug('Error during merging the records :' + de.getMessage());
}
Source Link

Unable to merge the custom records in salesforce

I couldnt merge the custom sobject records records. Its shows error like Specified type Candidate__c cannot be merged

My Code is : // Account creation code

List<Candidate__c> newCandidateList = new List<Candidate__c>();
Candidate__c c1= new Candidate__c();
c1.Years_of_experience__c = 4;
c1.Last_Name__c = 'Oracle';
c1.First_Name__c = 'Inc.';
newCandidateList.add(c1);
Candidate__c c2= new Candidate__c();
c2.Years_of_experience__c = 14;
c2.Last_Name__c = 'Oracle Inc';
c2.First_Name__c = 'Inc.';
newCandidateList.add(c2);
Candidate__c c3= new Candidate__c();
c3.Years_of_experience__c = 24;
c3.Last_Name__c = 'Oracle Inc';
c3.First_Name__c = 'India';
newCandidateList.add(c3);
insert newCandidateList;
system.debug('Insert List are :' + newCandidateList);

// Merging code

Candidate__c childrecords = [SELECT Id, Name, First_Name__c, Last_Name__c, Years_of_experience__c FROM Candidate__c WHERE First_Name__c = 'Inc.' LIMIT 1];
system.debug('Retrieved Child Records are :' +childrecords);
Candidate__c masterecord = [SELECT Id, Name, First_Name__c, Last_Name__c, Years_of_experience__c FROM Candidate__c WHERE First_Name__c = 'India' LIMIT 1];
system.debug('Master Records :' + masterecord);
try{
merge masterecord childrecords;
} catch (Exception de){
system.debug('Error during merging the records :' + de.getMessage());
}