+ Start a Discussion
Priyanka PallepatiPriyanka Pallepati 

salesforce MERGE_FAILED, Invalid field IsPartner for merge: []

Hello all -

I am trying to merge two accounts. Both the accounts, I am using a describe call to get all the fields. In my scenario I am checking if the master account has blank values in any of the fields, I am filling it with the losing account values. However when I merge (Database.merge(masteraccount,loseraccount), I get this error:

salesforce MERGE_FAILED, Invalid field IsPartner for merge: []

I checked few forums, but hardly got anything online.

Can anyone throw some light?


I don't think you can just arbitrarily assign the IsPartner field in a merge.

When merging accounts, there are restrictions relating to the partner portal (See https://help.salesforce.com/HTViewHelpDoc?id=account_merge.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=account_merge.htm&language=en_US))

Specifically: "You can merge accounts that have contacts associated with the same type of portal. For example, you can merge accounts that have contacts associated with a partner portal or Customer Portal, but you cannot merge an account that has contacts associated with a partner portal with an account that has contacts associated with a Customer Portal." and "When merging a partner account with a non-partner account, the partner account must be the master."

What I don't know is whether the error you are seeing indicates that you didn't meet one of the requirements on the page, or if Apex just blocks setting of IsPartner during merge in order to avoid problems, or if something else is going on.

But this is where I would start looking.

Priyanka PallepatiPriyanka Pallepati
yes I solved this one by ommitting ispartner and iscustomerportal fields from the describe call.
that solved the issue.
How were you able to omit those fields from the describe call?
And how were you checking for blank values on the master record so that the losing record could populate those fields?
Priyanka PallepatiPriyanka Pallepati
Try this:

 for (String fld : describeFlds.keyset()) {
             // add Account owner name
              // add Owner manager email    
               Schema.DescribeFieldResult fieldInfo = describeFlds.get(fld).getDescribe(); 
               // exclude standard fields that are not updatable and defaulted on create
               if (fieldInfo.isCreateable() && !fieldInfo.isDeprecatedAndHidden() && ((fieldInfo.isCustom() && !fieldInfo.isCalculated()) || (!fieldInfo.isCustom() && !fieldInfo.isDefaultedOnCreate() && fieldInfo.isUpdateable()))) { // consider fields that are updatable
Anand JeevakanAnand Jeevakan
Hi Priyanka - I face the same issue:
Invalid field IsCustomerPortal for merge

I'm able to filter this field in the keyset. However, the Database.merge consider all fields during merge operation and throws this error. The "communities" is not enabled in my org and not sure how this field is there in the first place. 
I understand this is 6 years old question, but your insights will be of help to me.

Thank you