You need to sign in to do that
Don't have an account?
Updating Profile - using metadata
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(); prtv[0].setRecordType("abc"); prtv[0].setDefault(true); prtv[0].setVisible(true); Profile pr = new Profile(); pr.setRecordTypeVisibilities(prtv); UpdateMetadata ut = new UpdateMetadata(); pr.setFullName("System_Administrator"); ut.setMetadata(pr);
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.
Thanks
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:
Thanks
All Answers
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:
Thanks
I would like to have the custom delete button for the user who do not have delete permission. The record should be deleted only if we override the current profile by setting delete permission for that particular object. I came across few blogs stating that it is possible using Metadata API by setting allowDelete as true. Please share the code.From were I should start.