Page Security Plugin
Apex page security plugins let developers control field-level visibility or data
entry mode in Salesforce CPQ VisualForce pages.
| Available in: All Salesforce CPQ Editions |
Let’s review a few common page security plugin use cases.
- You want to show or hide an important field on each quote line. For example, you’re selling training classes and you want to capture how many students are participating in the class. Set up your page security plugin so that the student number field shows only on quote lines related to your training class plugins.
- You want to make a field read-only or read-write based on its context. For example, you allow your users to specify the subscription term on each quote line, but you have some products that can only be quoted on a 12-month basis. A page security plugin can make the Subscription Term field read-only for such products, while keeping it read-write for the other products.
Example
1global class MyPageSecurityPlugin implements SBQQ.PageSecurityPlugin2 {
2 public Boolean isFieldEditable(String pageName, Schema.SObjectField field) {
3 return null;
4 }
5
6 public Boolean isFieldEditable(String pageName, Schema.SObjectField field, SObject record) {
7 return null;
8 }
9
10 public Boolean isFieldVisible(String pageName, Schema.SObjectField field) {
11 return null;
12 }
13
14 public Boolean isFieldVisible(String pageName, Schema.SObjectField field, SObject record) {
15 if ((pageName == 'EditLines') && (record instanceof SBQQ__QuoteLine__c)) {
16 SBQQ__QuoteLine__c line = (SBQQ__QuoteLine__c)record;
17 if ((line.SBQQ__Bundle__c == true) && (field != SBQQ__QuoteLine__c.SBQQ__ProductName__c)) {
18 return false;
19 }
20 }
21 return null;
22 }
23}