I needed to first create some Record Types for some custom objects using Metadata. After doing those, I was to upsert the records on those custom objects using the RecordTypeId.

I noticed one thing that one needs to set the visibility of the Record Types from Profile otherwise the Error comes - something like Invalide RecordTypeId for the User.

So, I have the flow of my application set from Java as

First create the Record Types, thereafter fetch the RecordTypeID and then upsert the records on the custom object I need to target.

So, I need to update the Profile using Metadata API itself to set the visibility of Record Types as:

ProfileRecordTypeVisibility[] prtv = new ProfileRecordTypeVisibility[recordTypes.size()];
prtv[0] = new ProfileRecordTypeVisibility();

Profile pr = new Profile();
UpdateMetadata ut = new UpdateMetadata();

So, I'm getting the Error like

com.sforce.ws.SoapFaultException: INVALID_CROSS_REFERENCE_KEY: In field: fullName - no Profile named System_Administrator found.

I have even tried System Administrator, Profile, Profile.System_Administrator but none worked for me.

The Salesforce doc says for the Profile object's fullName field: It must be specified when creating, updating, or deleting.

Please let me know what I'm doing wrong or is there anything else I can go for.


  • 2
    I logged in to my org via workbench.developerforce.com/login.php and used the Metadata Query feature to list the profiles and I don't see System Administrator. Can you perform this action via the UI out of interest? Also have you tried doing this on a custom profile? – Andrew Fawcett Sep 6 '13 at 7:53

I have found the solution by using fullName Admin which is got by querying Profile Object using listMetadata() method of MetadataConnection. The list of fullName of Standard Profiles then returned are as follows:

Customer Portal Manager Standard
Chatter Free User
Chatter External User
Customer Portal Manager Custom
Silver Partner User
Chatter Moderator User
Custom%3A Sales Profile
Partner App Subscription
Force%2Ecom - Free User
Custom%3A Marketing Profile
Custom%3A Support Profile
Force%2Ecom - App Subscription User
Gold Partner User

Thanks to Andrew who has given this idea.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.