# Write a SOQL query to fetch all Users who are assigned a specific Permission Set (PermissionSetAssignment where PermissionSet.Name = 'Sales_Ops').

**Topic:** Development · **Difficulty:** Medium · **Asked at:** Deloitte, Salesforce, Accenture · **Tags:** soql, scenario, permission-set, setup-objects

Read it on the site: https://www.forcechallenges.com/interview-questions/write-a-soql-query-to-fetch-all-users-who-are-assigned-a-specific-permission-set-permissionsetassignment

## Answer

Query `PermissionSetAssignment` and filter on the permission set name, selecting the assigned user details through the `Assignee` relationship.

```soql
SELECT Assignee.Id, Assignee.Name, Assignee.Username
FROM PermissionSetAssignment
WHERE PermissionSet.Name = 'Sales_Ops'
```
The API name goes in `PermissionSet.Name`, not the label.

---
Source: ForceChallenges · last updated 2026-10-19
