You need to sign in to do that
Don't have an account?

Create/Update Profiles Through Metadata API
Hello All,
I was trying to update an exsting profile with few permissions to the custom object but I was getting some errors while doing these...
I also tried creating a new profile throgh APIs but it doesn't worked.
Below is the snippet of my code.. Please let mw know if I'm missing something in this code...
However, If i try to creat a custom field with same logic, it gets created...
But creating or updating a profile fails everytime...
Please advise with a solution
Thanks in advance!
Saurabh
I was trying to update an exsting profile with few permissions to the custom object but I was getting some errors while doing these...
I also tried creating a new profile throgh APIs but it doesn't worked.
Below is the snippet of my code.. Please let mw know if I'm missing something in this code...
ProfileObjectPermissions pObj = new ProfileObjectPermissions(); pObj.setAllowCreate(true); pObj.setAllowEdit(true); pObj.setAllowDelete(true); pObj.setObject("Accounts"); pObj.setModifyAllRecords(true); Profile p = new Profile(); p.setObjectPermissions(new ProfileObjectPermissions[] {pObj}); p.setCustom(true); p.setUserLicense("Salesforce Platform"); p.setFullName("TestClient1"); //For Update I used.... SaveResult[] results = metadataConnection.updateMetadata(new Metadata[]{p}); //For Create I used... SaveResult[] results = metadataConnection.CreateMetadata(new Metadata[]{p});
However, If i try to creat a custom field with same logic, it gets created...
But creating or updating a profile fails everytime...
Please advise with a solution
Thanks in advance!
Saurabh
I tried retrieving the profile and object information and found that, the object name I used was wrong...
Correcting the name of object name helped me..
Thanks
Saurabh