You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile or permission set.: [Name]
LastName is a required field for PersonAccounts which is being provided in the defaults class. If I add Account.SObjectType => Account.LastName to nameFieldMap at Line 108, then I am unable to create Business Accounts.
There must be a way to say Name or LastName is required field depending upon what we are inserting: Accounts or PersonAccounts via createSObjectList() method.
Your suggestion: It would probably be better to refactor the code a bit and make a method to determine the name field since the logic is getting more complicated.
Please let me know if I can help.
Thank you.
The text was updated successfully, but these errors were encountered:
I am trying to do
List<Account> PersonAccs = (Account[]) TestFactory.createSObjectList(new Account(), 100, 'TestFactoryDefaults.PersonAccountDefaults');
And I get the following error:
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile or permission set.: [Name]
LastName is a required field for PersonAccounts which is being provided in the defaults class. If I add
Account.SObjectType => Account.LastName
to nameFieldMap at Line 108, then I am unable to create Business Accounts.There must be a way to say Name or LastName is required field depending upon what we are inserting: Accounts or PersonAccounts via createSObjectList() method.
Your suggestion: It would probably be better to refactor the code a bit and make a method to determine the name field since the logic is getting more complicated.
Please let me know if I can help.
Thank you.
The text was updated successfully, but these errors were encountered: