You need to sign in to do that
Don't have an account?
Constance Rouge 8
Merge person account - issue with Name
Hi Everyone,
I have an apex class that merges two person accounts in this piece of code (knowing all the accounts in the org are person accounts, so I am sure the result of the queries isn't a business account):
But I get this error:
INVALID_FIELD_FOR_INSERT_UPDATE, Account: bad field names on insert/update call: Name: [Name]
If I change my code and delete Name (wether I add FirstName and LastName in the query or not):
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Account.Name
Therefore, is there a way to use merge with two person accounts?
Thanks or your help!
Constance
I have an apex class that merges two person accounts in this piece of code (knowing all the accounts in the org are person accounts, so I am sure the result of the queries isn't a business account):
Account masterAcct= [SELECT Id, personEmail, Name FROM Account WHERE PersonEmail= :leadToConvertEmail LIMIT 1]; Account newAcct = [SELECT Id, PersonEmail, Name FROM Account WHERE Id= :acctIdToCheck LIMIT 1]; merge masterAcct newAcct;
But I get this error:
INVALID_FIELD_FOR_INSERT_UPDATE, Account: bad field names on insert/update call: Name: [Name]
If I change my code and delete Name (wether I add FirstName and LastName in the query or not):
Account masterAcct= [SELECT Id, personEmail FROM Account WHERE PersonEmail IN :leadsEmailList LIMIT 1]; Account newAcct = [SELECT Id, PersonEmail FROM Account WHERE Id= :acctIdToCheck LIMIT 1]; //Same result with: Account masterAcct= [SELECT Id, personEmail, salutation, firstName, lastName FROM Account WHERE PersonEmail IN :leadsEmailList LIMIT 1]; //And: Account newAcct = [SELECT Id, PersonEmail, salutation, firstName, lastName FROM Account WHERE Id= :acctIdToCheck LIMIT 1]; merge masterAcct newAcct;I get the following error:
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Account.Name
Therefore, is there a way to use merge with two person accounts?
Thanks or your help!
Constance
Constance Rouge 8
I forgot to precise there is some piece of code between the queries, so it looks more like:
suman kumar 59
Include FirstName,LastName,MiddleName, in your SOQL query this should resolve the issue