I am trying to create a permission set in my code but I'm getting some issues when I tried to assign an Idea, Product2 or Pricebook. With some other objects like custom or other Standards, I'm able to do it without any issue.

What is it wrong?

PermissionSet ps = new PermissionSet();
insert ps;

//insert Object permission for Idea
ObjectPermissions op = new ObjectPermissions();
op.parentId = ps.Id;
op.SobjectType = 'Idea';
op.PermissionsCreate = true;
op.PermissionsRead = true;
insert op;

The error that I'm getting is

System.DMLException: Insert failed. 
First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, 
The following permission isn't allowed: Read All Idea: []


| improve this question | | | | |
  • Odd. I got the same error when trying from anonymous Apex against Product2 but was able to create the ObjectPermissions via the UI with /0PS700000000001/e?s=EntityPermissions&o=Product2. Can you create them via the GUI for Ideas? – Daniel Ballinger Dec 19 '13 at 20:36
  • Yes, if I try via UI, there is no issue and I'm able to create whatever I need. I only get the error if I do it via Console or anonymous. – Agustina García Dec 20 '13 at 8:53

Agustina, thank you for posting. I am on the Admin team at salesforce.com and have been able to reproduce this particular issue. You should be able to perform the action you are attempting, but our API validation logic, in this scenario, is slightly too aggressive. I have logged a work item and this will be fixed in an upcoming release.

However, as a work-around, you can use the Metadata API to update the CRUD values on one or multiple permission sets. (keep ViewAll and ModifyAll set to False)

<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">

Thank you again for posting and bringing this to our attention.


| improve this answer | | | | |
  • Thank you very much for the quick reply. Really appreciate it – Agustina García Dec 20 '13 at 23:04
  • Having same problem with v29.0, will try the metadata api as a workaround. Look forward to fix. Thanks – Doug Ayers Feb 6 '14 at 4:35
  • The issue should be resolved with the release of Summer '14 (see trust.salesforce.com for the release schedule). – John Brock Jul 10 '14 at 5:54

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.