function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CarlBCarlB 

Metadata setObjectPermissions(...) not working

Hello.

I have written a Java client that uses the metadata API in order to update the user profiles in an org.  I am able, for example, to change the tab visibility on the profiles.  However, when I try to change the object permissions for one of my custom objects on the user profile, using
 
ProfileObjectPermissions [] pers = new ProfileObjectPermissions[] { new ProfileObjectPermissions(Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, "MY_CUSTOM_OBJECT__C", Boolean.FALSE), ... };
p.setObjectPermissions(pers);

When I update the metadata, no errors are returned, but the permissions on the user profile for the object remain unchanged.

Any idea what I am missing?

Thanks,

Carl



 
ShashankShashank (Salesforce Developers) 
You may find this helpful: https://github.com/palominolabs/sf-api-connector/blob/master/soap-api-connector/src/main/java/com/palominolabs/crm/sf/soap/ProfileObjectPermissions.java