{"id":"sforce_api_objects_objectpermissions","title":"ObjectPermissions","content":"<a name=\"sforce_api_objects_objectpermissions\"><!-- --></a><h1 class=\"helpHead1\">ObjectPermissions</h1><div class=\"body\">\n<div class=\"shortdesc\">\n<span class=\"ph\" id=\"summary\"><a name=\"summary\"><!-- --></a><span class=\"ph\" id=\"description\"><a name=\"description\"><!-- --></a>Represents the enabled object permissions for\n            the parent PermissionSet.</span>\n      </span>This object is available in API version 24.0 and later.</div>\n\n      <p class=\"p\">To grant a user access to an object, associate an ObjectPermissions record with a\n         PermissionSet that’s assigned to a user. ObjectPermissions records are only supported in\n         PermissionSet, not in Profile.</p>\n\n      <div class=\"section\">\n<h2 class=\"helpHead2\">Supported Calls</h2>\n\n         \n         <p class=\"p\"><samp class=\"codeph nolang\">create()</samp>, <samp class=\"codeph nolang\">delete()</samp>, <samp class=\"codeph nolang\">describeSObjects()</samp>, <samp class=\"codeph nolang\">query()</samp>, <samp class=\"codeph nolang\">retrieve()</samp>, <samp class=\"codeph nolang\">update()</samp>, <samp class=\"codeph nolang\">upsert()</samp></p>\n\n      </div>\n\n      <div class=\"section\">\n<h2 class=\"helpHead2\">Special Access Rules</h2>\n\n         \n         <p class=\"p\">As of Summer ’20 and later, only users with the View Setup and Configuration permission\n            can access this object. </p>\n\n      </div>\n\n      <div class=\"section\">\n<h2 class=\"helpHead2\">Fields</h2>\n\n         \n         \n<div class=\"data colSort\"><table class=\"featureTable sort_table\" summary=\"\">\n               \n               \n               <thead class=\"thead sorted\" align=\"left\">\n                  <tr>\n                     <th class=\"featureTableHeader  \" id=\"d1329364e112\">Field Name</th>\n\n                     <th class=\"featureTableHeader  \" id=\"d1329364e115\">Details</th>\n\n                  </tr>\n\n               </thead>\n\n               <tbody class=\"tbody\">\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\">ParentId</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">reference</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Group, Sort</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">The <span class=\"keyword parmname\">Id</span> of this object’s parent <a class=\"xref\" href=\"atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_permissionset.htm\" title=\"Represents a set of permissions that’s used to grant more access to one or more users without changing their profile or reassigning profiles. This object is available in API version 22.0 and later.\">PermissionSet</a>.</dd>\n\n                              <dd class=\"dd\">This is a relationship field.</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Relationship Name</dt>\n\n                              <dd class=\"dd\">Parent</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Relationship Type</dt>\n\n                              <dd class=\"dd\">Lookup</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Refers To</dt>\n\n                              <dd class=\"dd\">PermissionSet</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\" id=\"PermCreate\"><a name=\"PermCreate\"><!-- --></a>PermissionsCreate</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can create records for this object. <span class=\"ph\" id=\"ReqPermsReadTrue\"><a name=\"ReqPermsReadTrue\"><!-- --></a>Requires\n                                       <span class=\"keyword parmname\">PermissionsRead</span> for the same object to\n                                    be <samp class=\"codeph nolang\">true</samp>.</span>\n</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\" id=\"PermDelete\"><a name=\"PermDelete\"><!-- --></a>PermissionsDelete</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can delete records for this object.\n                                 Requires <span class=\"keyword parmname\">PermissionsRead</span> and\n                                    <span class=\"keyword parmname\">PermissionsEdit</span> for the same object to be\n                                    <samp class=\"codeph nolang\">true</samp>.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\" id=\"PermEdit\"><a name=\"PermEdit\"><!-- --></a>PermissionsEdit</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can edit records for this object.\n                                    Requires <span class=\"keyword parmname\">PermissionsRead</span> for the same\n                                    object to be <samp class=\"codeph nolang\">true</samp>.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\" id=\"PermMAR\"><a name=\"PermMAR\"><!-- --></a>PermissionsModifyAllRecords</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can edit all records for this object,\n                                 regardless of sharing settings. Requires\n                                    <span class=\"keyword parmname\">PermissionsRead</span>,\n                                    <span class=\"keyword parmname\">PermissionsDelete</span>,\n                                    <span class=\"keyword parmname\">PermissionsEdit</span>, and\n                                    <span class=\"keyword parmname\">PermissionsViewAllRecords</span> for the same\n                                 object to be <samp class=\"codeph nolang\">true</samp>.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\" id=\"PermRead\"><a name=\"PermRead\"><!-- --></a>PermissionsRead</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can view records for this object.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\">PermissionsViewAllFields</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can view all fields and field data for\n                                 this object. Available in API version 63.0 and later.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\" id=\"PermVAR\"><a name=\"PermVAR\"><!-- --></a>PermissionsViewAllRecords</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">boolean</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Update</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">If <samp class=\"codeph nolang\">true</samp>, users assigned to\n                                 the parent PermissionSet can view all records for this object,\n                                 regardless of sharing settings. Requires\n                                    <span class=\"keyword parmname\">PermissionsRead</span> for the same object to be\n                                    <samp class=\"codeph nolang\">true</samp>.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n                  <tr>\n                     <td class=\"entry\" headers=\"d1329364e112\" data-title=\"Field Name\"><span class=\"keyword parmname\">SobjectType</span></td>\n\n                     <td class=\"entry\" headers=\"d1329364e115\" data-title=\"Details\">\n                        <dl class=\"dl detailList\">\n                           \n                              <dt class=\"dt dlterm\">Type</dt>\n\n                              <dd class=\"dd\">picklist</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Properties</dt>\n\n                              <dd class=\"dd\">Create, Filter, Group, Restricted picklist, Sort</dd>\n\n                           \n                           \n                              <dt class=\"dt dlterm\">Description</dt>\n\n                              <dd class=\"dd\">The object’s API name. For example, <samp class=\"codeph nolang\">Merchandise__c</samp>.</dd>\n\n                           \n                        </dl>\n\n                     </td>\n\n                  </tr>\n\n               </tbody>\n\n            </table></div>\n\n      </div>\n\n      <div class=\"section\">\n<h2 class=\"helpHead2\">Permission Dependencies</h2>\n\n         \n         <p class=\"p\">Some user permissions have dependencies on object permissions. For example, if a\n            permission set has the “Transfer Leads” permission, it also has\n            “Read” and “Create” on the leads object.</p>\n\n         <p class=\"p\">You can query from ObjectPermissions up to the parent PermissionSet object. For\n            example:</p>\n\n         <div class=\"codeSection soql\"><pre class=\"codeblock brush:plain\">SELECT Parent.Name, Parent.PermissionsTransferAnyLead, PermissionsRead, PermissionsCreate\nFROM ObjectPermissions\nWHERE SobjectType = 'Lead'</pre></div>\n\n      </div>\n\n      <div class=\"section\">\n<h2 class=\"helpHead2\">Determining Object Access with “Modify All Data”</h2>\n\n         \n         <p class=\"p\">When using SOQL to query object permissions, be aware that some object permissions are\n            enabled because a user permission requires them.</p>\n\n         <p class=\"p\">The exception to this rule is when “Modify All Data” is enabled. While it\n            enables all object permissions, it doesn’t physically store any object permission\n            records in the database. As a result, unlike object permissions that are required by a\n            user permission—such as “View All Data” or “Import\n            Leads”—the query still returns permission sets with “Modify All\n            Data,” but the object permission record will contain an invalid ID that begins\n            with “000”. This ID indicates that the object has full access due to\n            “Modify All Data” and the object permission record can’t be updated\n            or deleted. To remove full access from these objects, disable “Modify All\n            Data” and then delete the resulting object permission record. This ensures that\n            when using SOQL to find all the objects that have full access, it returns all objects\n            that have this access regardless of whether it’s due to “Modify All\n            Data” or because an administrator set full access.</p>\n\n         <p class=\"p\">For example, the following will return all permission sets that have\n            “Read” on the Merchandise__c object, regardless of whether it’s\n            explicitly defined on the object or implicitly defined through “Modify All\n            Data.”</p>\n\n         <div class=\"codeSection soql\"><pre class=\"codeblock brush:plain\">SELECT Id, Parent.label, SobjectType, PermissionsRead,\n   Parent.PermissionsModifyAllData, ParentId\nFROM ObjectPermissions\nWHERE PermissionsRead = true and SobjectType = 'Merchandise__c'</pre></div>\n\n      </div>\n\n      <div class=\"section\">\n<h2 class=\"helpHead2\">Nesting Object Permissions</h2>\n\n         \n         <div class=\"p\">You can nest ObjectPermissions in a PermissionSet query. For example, the following\n            returns any permission sets where “Transfer Leads” is true. Additionally, the result set\n            will include the “Read” object permission on leads. This is done by nesting the SOQL\n            with an object permission query using the relationship name for object permissions:\n               <samp class=\"codeph nolang\">ObjectPerms</samp>.<div class=\"codeSection soql\"><pre class=\"codeblock brush:plain\">SELECT Id,Name,PermissionsTransferAnyLead,\n(SELECT Id, PermissionsRead from ObjectPerms where SobjectType='Lead')\nFROM PermissionSet\nWHERE PermissionsTransferAnyLead = true</pre></div>\n</div>\n\n         <p class=\"p\">As a result, it’s possible to traverse the relationship between the PermissionSet and\n            any child-related objects (in this case, ObjectPermissions). You can do this from the\n            PermissionSet object by using the child relationship (<samp class=\"codeph nolang\">ObjectPerms</samp>, <samp class=\"codeph nolang\">FieldPerms</samp>, and so on) or\n            from the child object by referencing the PermissionSet with <samp class=\"codeph nolang\">Parent.<var class=\"keyword varname\">permission_set_attribute</var></samp>.</p>\n\n         <p class=\"p\">It’s important to consider when to use a conditional <samp class=\"codeph soql\">WHERE</samp> statement to restrict the result set. To query based on an attribute\n            on the permission set object, nest the SOQL with the child relationship. However, to\n            query based on an attribute on the child object, you must reference the permission set\n            parent attribute in your query.</p>\n\n         <div class=\"p\">The following two queries return the same columns with different results, based on\n            whether you use the child relationship or parent\n            notation.<div class=\"codeSection soql\"><pre class=\"codeblock brush:plain\">SELECT Id, Name, PermissionsModifyAllData,\n(SELECT Id, SobjectType, PermissionsRead from Objectperms)\nFROM PermissionSet\nWHERE PermissionsModifyAllData=true</pre></div>\nversus:<div class=\"codeSection soql\"><pre class=\"codeblock brush:plain\">SELECT Id, SObjectType, PermissionsRead, Parent.Id, Parent.Name, Parent.PermissionsModifyAllData\nFROM ObjectPermissions\nWHERE SObjectType='Merchandise__c'</pre></div>\n</div>\n\n      </div>\n\n   </div><div id=\"sfdc:seealso\" class=\"related-links\">\n<div class=\"relinfo\">\n<h4>See Also</h4>\n<ul class=\"unstyled\">\n<li><div><a class=\"link\" href=\"atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_permissionset.htm\" title=\"Represents a set of permissions that’s used to grant more access to one or more users without changing their profile or reassigning profiles. This object is available in API version 22.0 and later.\">PermissionSet</a></div></li>\n<li><div><a class=\"link\" href=\"atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_fieldpermissions.htm\" title=\"Represents the enabled field permissions for the parent PermissionSet. This object is available in API version 24.0 and later.\">FieldPermissions</a></div></li>\n</ul>\n</div>\n</div>"}