function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Avoid Sharing to users who have no access to the object

Hi all,


Is there a way to avoid sharing records fro users who dont have access to the object.


in soql even we used with sharing keyword, records are retrieved for the users who have sharing records but not read access in profile



Use 'with sharing' modifier while defining the class. Ex:

public with sharing class sharingClass {

// Code here


For details refer: