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
1cgcloud
Example 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 {23 global Object call(String action, Map<String, Object> args) {4 // Read Transaction Id5 String txId = (String) args.get('txId');6 // Get the Promotion Id7 Id promotionId = args.get('promotionId'); 8 // Get the EARights9 List<cgcloud.EARightsAccess> tacticRights = (List<cgcloud.EARightsAccess>) args.get('EARights');1011 // Get the relevant record type id12 Id LUMP_SUM_TACTIC_RECTYPE_ID = '01x000000000000000';1314 // Custom logic goes here15 for (cgcloud.EARightsAccess ear: tacticRights) {16 // EXAMPLE: Compensation Model is disabled for17 // specific Tactic RecordType id18 if (ear.Name == cgcloud__Tactic__c.cgcloud__Compensation_Model__c.getDescribe().getName()) {19 ear.forRecordType(recordTypeId).Editable = false;20 }2122 // EXAMPLE: SPC card is disabled for23 // specific Tactic RecordType id24 if (ear.Name == 'SPEND_PLANNING_CARD') {25 ear.forRecordType(recrodTypeId).Editable = false;26 }27 }2829 }30}