You need to sign in to do that
Don't have an account?
Permissions Error on Deployment
When trying to deploy my custom controller and VF pages for our Sites site from Eclipse, when running the test cases I get the following error
StudentApplicationControllerTest.testController System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, entity type cannot be inserted: Person Account: []
According to the WSDL docs this is a permissions error as follows:
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
You do not have permission to create, update, or activate the specified record.
This doesn't make sense as I am the System Admin and have permissions to all objects, fields, record types, etc.
Here is the getter that creates the Person Account record
public Account getStudent() { if(student == null) { RecordType recType = getPersonAccountRecordTypeId(); student = new Account(recordtypeid=recType.id,web_submission__c=true); //student = new Account(); } return student; } RecordType getPersonAccountRecordTypeId() { return [select id,name,sobjectType,ispersontype from recordType where ispersontype=true and sobjectType='account' limit 1]; }
This is preventing our move to production and is critical.
Any help is much appreciated.
Doh!
Of course, I forgot, I set the test to run as the website profile, which didn't have the right perms. Now it works.
Thanks.
All Answers
Hi,
Looks like there is some problem in your test method.
Something is going wrong in your test method when you are trying to insert PersonAccount record.
Check your test method. Also you can post your Test method here.
Doh!
Of course, I forgot, I set the test to run as the website profile, which didn't have the right perms. Now it works.
Thanks.
Gr8!!
If that sloves your problem please mark it solved!!
Hi.
Hi,
There are couple of issues with your code (anyways we will try to solve your test method issue).
Do following things in your test method.
1. Insert Contacts in your test method. ie. write a code to insert the dummy contacts.
ie.
Contact objCon = new Contact();
objCon.Name = 'Test';
insert objCon; //If you want to insert multiple contacts use list and then insert
2. change line