Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Legacy Page Security Plugin (Apex)
| Available in: All Salesforce CPQ Editions |
The Legacy Page Security Plugin handles two types of use cases.
- Show or hide fields on each quote line
- For example, you’re selling training classes and you want to capture how many students are participating in the class. Use the page security plugin to hide a student number field.
- Make quote line fields read-only or writable
- 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. Use the page security plugin to make the Subscription Term field read-only for such products, while keeping it writable for the other products.
To use the Legacy Page Security Plugin, first create an Apex class. Then enter the Apex class name in the Legacy Page Security Plugin setting in the Salesforce CPQ package settings. You can call only one Apex class at a time in the Legacy Page Security Plugin.
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}