+ Start a Discussion
Vaclav LukasekVaclav Lukasek 

Create Account in test with runAs cause INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

when is create Account in runAs block and when I set Account.ParentId to some account, it fails on INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
runAs user has System administrator profile
Account sharing rule for Parent Account contain runAs user with read/write access
triggers are empty
when I dont set ParentId, test pass
when I dont use system.runAs, test pass
 
Alba RivasAlba Rivas
I don't think you can update an object's parentId. Please take a look at this thread https://developer.salesforce.com/forums/?id=906F000000090WSIAY
Vaclav LukasekVaclav Lukasek
why do you thing i'm updating record?
1/ I wrote i created Account(mean with ParentId)
2/ if record allow to reparent object, it can be also changed