【Salesforce】【Developer】 Apex study --difference between with sharing and without sharing

what is difference between with sharing and without sharing in salesforce?

Class with sharing and without sharing in Salesforce. With Sharing - Enforce the sharing rules that apply to current user. Without Sharing - Doesn't enforce the sharing rules. ... This means that if the class is called by a class that has sharing enforced, then sharing is enforced for the called class.

 

With Sharing -实施共享规则适用于当前用户。

Without Sharing - 不执行共享规则。 ...这意味着如果该类由已共享的类调用,则对被调用的类强制共享。

1.我先找到account sharing setting

【Salesforce】【Developer】 Apex study --difference between with sharing and without sharing_第1张图片

2.给account 设定一个共享规则。这里设置的是内部用户的record可以以只读的方式共享给CEO。

【Salesforce】【Developer】 Apex study --difference between with sharing and without sharing_第2张图片

3.写一个类适用共享规则。应该是CEO可以看到你写的类。

【Salesforce】【Developer】 Apex study --difference between with sharing and without sharing_第3张图片

初学Salesforce,以上只是个人理解,有不对,请指教。

你可能感兴趣的:(【Salesforce】【Developer】 Apex study --difference between with sharing and without sharing)