Skip to main content


Showing posts from August, 2013

About sharing that I misunderstood

Sharing means caring literally.In salesforces, with sharing means I want to share based on the rules. By default, Apex class does not effected by  current user's permissions, field-level security, and sharing rules.Because it run in system context .Oh,please note this is not include Apex code that run in Execute Anonymous.Code in Execute Anonymous still effected by permission of the current user. So this is the reason why with sharing and without sharing keywords come for.But only to control sharing rules. Use with sharing to enforce the sharing rules that apply to the current user. Use without sharing  to ensure that the sharing rules for the current user are not enforced. How about if the class use neither with sharing or without sharing? Still the current sharing rules remain in effect. All the details can be check at Using the with sharing or without sharing Keywords . Actually why suddenly I babbling about sharing?Because it cause me headache  for almost who