# Query CRED And FLS Permissions - Examples

<section class="yaqOZd qeLZfd" id="bkmrk-query-all-permission"><div>**Query All Permissions**</div>To get a list of every CRED setting for every Profile and Permission Set in Salesforce run the following query, or use Data Loader to export all ObjectPermissions records with the following fields:

```
`SELECT Id, ParentId, Parent.ProfileId, Parent.Profile.Name, SobjectType, PermissionsCreate, PermissionsDelete, PermissionsEdit, PermissionsRead, PermissionsViewAllRecords, PermissionsModifyAllRecords<br></br>FROM ObjectPermissions`
```

</section><section class="yaqOZd qeLZfd" id="bkmrk-to-query-all-field-p">To query all Field permissions use a similar query:

<div>```
SELECT Id, ParentId, Parent.ProfileId, Parent.Profile.Name, SobjectType, Field, PermissionsEdit, PermissionsRead<br></br>FROM FieldPermissions
```

</div><div><div><div aria-describedby="h.p_8Uo5Wfy71pzP" aria-disabled="false" aria-hidden="true" aria-label="Copy heading link" data-tooltip="Copy heading link" data-tooltip-horizontal-offset="0" data-tooltip-position="top" data-tooltip-vertical-offset="12"><div><div></div><div>**Query Permissions For Specific Profiles**</div></div></div></div></div>In order to limit your search to specific profiles, add a filter to the end using the `Parent.ProfileId` field . Example:

<div>```
SELECT Id, (...)<br></br>FROM (...) <br></br><strong>WHERE Parent.Profile.Name = 'Sales Manager'</strong>
```

</div>Or if you have a list of profiles:

<div>```
SELECT Id, (...)<br></br>FROM (...) <br></br><strong>WHERE Parent.Profile.Name IN ('Sales Manager', 'Sales', 'Marketing')</strong>
```

</div></section><section class="yaqOZd qeLZfd" id="bkmrk-query-permissions-fo"><div><div><div aria-describedby="h.p_3tr2ekvo1pzR" aria-disabled="false" aria-hidden="true" aria-label="Copy heading link" data-tooltip="Copy heading link" data-tooltip-horizontal-offset="0" data-tooltip-position="top" data-tooltip-vertical-offset="12"><div><div></div><div>**Query Permissions For Profiles Only (Or Permission Sets Only)**</div></div></div></div></div>To limit your query to only see permissions related to Profiles and not Permission Sets, add a filter to the end using the `Parent.ProfileId` field to make sure it’s not empty:

<div>```
SELECT Id, (...)<br></br>FROM (...)<br></br><strong>WHERE Parent.ProfileId != null</strong>
```

</div>Conversely, to limit your query to only show permissions related to Permission Sets, adjust the filter:

<div><div><div><div><div><div><div><div><div><div><div>```
WHERE Parent.ProfileId <strong>= null</strong>
```

</div></div></div></div></div></div></div></div></div></div></div><div><div><div aria-describedby="h.p_xNZKQ6451pzS" aria-disabled="false" aria-hidden="true" aria-label="Copy heading link" data-tooltip="Copy heading link" data-tooltip-horizontal-offset="0" data-tooltip-position="top" data-tooltip-vertical-offset="12"><div><div></div><div>**Query Permissions For Specific Objects**</div></div></div></div></div>In order to limit the Objects you want permissions for, add a filter to the end using the `SobjectType` field. Example:

<div>```
SELECT Id, (...)<br></br>FROM (...)<br></br>WHERE SobjectType IN ('Account','Opportunity','Contact')
```

</div><div></div><div>**Query Permissions For Specific Fields**</div>In order to limit the Fields you want permissions for, add a filter to the end using the `Field` field. Note that the values in the `Field` field include API name of the Object, followed by a period, then the API name of the Field. Example:

<div>```
SELECT Id, (...)<br></br>FROM (...)<br></br>WHERE Field IN ('Account.Customer__c','Opportunity.Total__c','Contact.LastName')
```

</div></section>