---
title: Classes Should Explicitly Declare A Sharing Mode If DML Methods Are Used
description: "Impact Area Security Severity High Affected Element Apex Class ## Rule ID **SF-0018** ## Impact Developers should take access restrictions into account before modifying objects. ## Remediation Declare a sharing model in all classes with DML statements. ### Time to…"
url: "https://community-staging.qualityclouds.com/qcdocs/qcr/rules/classes-should-explicitly-declare-a-sharing-mode-if-dml-methods-are-used/"
updated: "2025-03-21"
category: PMD Rules
---

# Classes Should Explicitly Declare A Sharing Mode If DML Methods Are Used

Impact Area

Security

Severity

High

           Affected Element

Apex Class

## Rule ID

**SF-0018**

## Impact

Developers should take access restrictions into account before modifying objects.

## Remediation

Declare a sharing model in all classes with DML statements.

### Time to fix

60 min

## References

This rule is linked to [Common Weakness Enumeration CWE-284 Improper Access Control](https://cwe.mitre.org/data/definitions/284.html).
