Newer Version Available
EARightsAccess Class
Use the EARightsAccess class to access EARights the
application uses.
You can’t add new instances of this class. However, you can modify the existing instances to change EARights of the existing elements.
Each EARightsAccess instance provides these properties:
- Name: String (name of the right)
- Type: String (category of the right)
- Visible: Boolean (indicates whether the referenced item is visible)
- Editable: Boolean (indicates whether the referenced item is editable)
Namespace
1cgcloudExample Implementation
1cgcloud.EARightsAccess eaRights;Supported Methods
forRecordType
Set EARights for different record types of the Promotion and Tactic sObject by calling the forRecordType method on an EARightsAccess instance. This method returns a new EARightsAccess instance where you can set specific visibility and editability permissions for the record type ID of a record.
Example
Here’s an example that shows how to disable the compensation model and SPC card for a specific tactic record type ID:
1global class TacticEARights implements System.Callable {
2
3 global Object call(String action, Map<String, Object> args) {
4 // Read Transaction Id
5 String txId = (String) args.get('txId');
6 // Get the Promotion Id
7 Id promotionId = args.get('promotionId');
8 // Get the EARights
9 List<cgcloud.EARightsAccess> tacticRights = (List<cgcloud.EARightsAccess>) args.get('EARights');
10
11 // Get the relevant record type id
12 Id LUMP_SUM_TACTIC_RECTYPE_ID = '01x000000000000000';
13
14 // Custom logic goes here
15 for (cgcloud.EARightsAccess ear: tacticRights) {
16 // EXAMPLE: Compensation Model is disabled for
17 // specific Tactic RecordType id
18 if (ear.Name == cgcloud__Tactic__c.cgcloud__Compensation_Model__c.getDescribe().getName()) {
19 ear.forRecordType(recordTypeId).Editable = false;
20 }
21
22 // EXAMPLE: SPC card is disabled for
23 // specific Tactic RecordType id
24 if (ear.Name == 'SPEND_PLANNING_CARD') {
25 ear.forRecordType(recrodTypeId).Editable = false;
26 }
27 }
28
29 }
30}