So far I'm able to create the Record Type for an object using Java.

  1. For the object requiring only 1 Record Type using Java: (the upserts are going fine) - If I'm to create only one record Type per object then it executes right. (e.g from the user input accepting the Record Type name to be created for any object, then it is updated for the logged-in user's profile to make it visible, after that the upserts are performed by using the RecordTypeId and it goes fine - Tested for each object in concern).

  2. For the object requiring more than 1 Record Type using Java: (any upsert leads to an error) - If I'm to make multiple Record Types from Java (e.g I'm able to make them created as well as successfully updated on Profile but during upserts I'm getting the Error INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY:insufficient access rights on cross-reference id )

Solution: (Manual updation of Profile)

One workaround I found for this: If we go to Profile --> Record Type Settings --> Edit (Object name) and again save without doing modifications, thereafter if we perform the upsert operations it goes fine.

These all operations are automated using Metadata API of Salesforce from Java.

Can you let me know if I'm doing anything wrong or there could be any other way around? So, that this Manual updation can be removed.

1 Answer 1


Sanchit - when you are attempting to upsert, ensure you are defining the default record type for profile. When one record type is created, it is automatically defaulted because you cannot have the Master RT and a custom RT; however, when you attempt to create two record types, Master (the default before custom RTs are created) access for the profile is removed -- if a new default isn't specified, it might be causing this error.

  • John - I have taken account of this already. Salesforce internally forces us to even make one Record Type as Default. And for multiple RTs I'm trying to make one of them to be as default otherwise they wouldn't be updated on the Profile. I have double checked it for both 1 RT as well as more than 1 RTs that in both the cases I'm programatically creating the default RT always.
    – sanchit
    Commented Sep 11, 2013 at 3:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .