---
schema_version: "1"
id: 7740060c0d751704ff8c2410f9a45e84d0bb5c8b09f9fb28cb6030bd60ef1a3f
title: The WITH SECURITY_ENFORCED SOQL Clause is Removed
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/release-notes/262-0-0/rn_apex_removed_withSecurityEnforced.md
canonical_url: https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_removed_withSecurityEnforced.htm&release=262.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 068ddc10bd629afe10ea2b1662bbb320e71f4cf0f7ff4a8a9f857b4a30f982a7
description: To run a SOQL or SOSL query in user mode, use the WITH USER_MODE clause instead of the WITH SECURITY_ENFORCED clause. Apex classes set to API version 67.0 and later that include WITH SECURITY_ENFORCED don’t compile.
products:
  - Cross Cloud
release: "262"
---
# The WITH SECURITY\_ENFORCED SOQL Clause is Removed 

To run a SOQL or SOSL query in user mode, use the `WITH USER_MODE` clause instead of the `WITH SECURITY_ENFORCED` clause. Apex classes set to API version 67.0 and later that include `WITH SECURITY_ENFORCED` don’t compile.

**Where:** This versioned change applies to API version 67.0 and later. The change applies to Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions.

**Why:** `WITH USER_MODE` replaces `WITH SECURITY_ENFORCED` because of these additional advantages.

- `WITH USER_MODE` accounts for polymorphic fields, such as Owner and Task.whatId.
- `WITH USER_MODE` processes all clauses in the SOQL `SELECT` statement including the `WHERE` clause.
- `WITH USER_MODE` finds all FLS errors in your SOQL query, while `WITH SECURITY_ENFORCED` finds only the first error. Furthermore, in user mode, you can use the `getInaccessibleFields()` method on `QueryException` to examine the full set of access errors.

**How:** To avoid compilation errors in API version 67.0 and later, replace all instances of `WITH SECURITY_ENFORCED` in your code with `WITH USER_MODE`.

```java
Account acc = [SELECT Id FROM Account WHERE Name = 'Singha' WITH USER_MODE LIMIT 1];
```

#### See Also

- [_Apex Developer Guide:_ Set an Access Mode for Database Operations](https://developer.salesforce.com/docs/atlas.en-us.262.0.apexcode.meta/apexcode/apex_classes_enforce_usermode.htm)
- [_Apex Developer Guide_: Apex Security and Sharing Model](https://developer.salesforce.com/docs/atlas.en-us.262.0.apexcode.meta/apexcode/apex_security_sharing_chapter.htm)