+ Start a Discussion
Jessica MockJessica Mock 

controller extension error

Our developer is trying to develop visual force pages and is getting the following errors.
 
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: this ID value isn't valid for the user: : [RecordTypeId]
 
Any ideas?
Crystal Rochlitz 4Crystal Rochlitz 4
Check user permissions for the record type to see that the running user has the appropriate record type and layout permissions. If that doesn't solve the problem, please reply.
Jessica MockJessica Mock
Thank you for replying. I am logged in as system administrator. I have access to the record type. I have 2 record types and it defaults to one. If our developer does not add a record type to the code, it auto default record type and creates my record without any issues.
Crystal Rochlitz 4Crystal Rochlitz 4
Just as a precautionary measure, the id value you are using for the record type of isn't hardcoded is it? If so, this may be the issue and you should run a query or use a Schema describe to get the value. Other than that, I can't think of any other reasons why you would not be able to access the record type. Let me know if you are still stuck and I will keep looking for an answer.