You need to sign in to do that
Don't have an account?
Gerbrand Spaans
Difference between result from developer console and Illuminated Cloud
We are trying to test some funcitonality and found that the below snippet of code, when executed anonymously, can have different results. When executed on a sandbox using Developer Console, we get an error, saying that it is impossible to do this. But when executed anonymously through the Illuminated Cloud plugin from IntelliJ we get the result 'Success'.
// Create account Account a = new Account(Name = 'Donald Duck'); Database.insert(a); // create contact and relate to account Contact ct = new Contact(FirstName = 'Donald', LastName = 'Duck', AccountId = a.Id); Database.insert(ct); // get recordtype Id RecordType rt = [SELECT Id FROM RecordType WHERE IsPersonType = true And SobjectType = 'Account']; // set record type id to person account Account acc = [SELECT Id, RecordTypeId FROM Account WHERE Id = :a.Id]; acc.RecordTypeId = rt.Id; // update account to person account Database.update(acc);Anyone any ideas why this might happen?
And this is not really an unexpected error, but the weird thing is that this piece of code is actually working when I run it in the Anonymous Apex tab in the IlluminatedCloud plugin. The users we use are the same.