---
schema_version: "1"
id: 3cd6cf1f40685a4b83613741517c631dae169132fbc311df412d8f954b14c7dc
title: EARightsAccess Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/tpm_editaccessrights_class.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/tpm_editaccessrights_class.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 935f67bcb7c36d5084824a45f52893817a7fc52451e8b612e93b765038420243
description: Use the EARightsAccess class to access EARights the application uses.
---
# 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

cgcloud

## Example Implementation

cgcloud.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:

global class TacticEARights implements System.Callable {

    global Object call(String action, Map<String, Object> args) {
        // Read Transaction Id
        String txId = (String) args.get('txId');
        // Get the Promotion Id
        Id promotionId = args.get('promotionId'); 
        // Get the EARights
        List<cgcloud.EARightsAccess> tacticRights = (List<cgcloud.EARightsAccess>) args.get('EARights');
        
        // Get the relevant record type id
        Id LUMP\_SUM\_TACTIC\_RECTYPE\_ID = '01x000000000000000';
        
        // Custom logic goes here
        for (cgcloud.EARightsAccess ear: tacticRights) {
            // EXAMPLE: Compensation Model is disabled for
            // specific Tactic RecordType id
            if (ear.Name == cgcloud\_\_Tactic\_\_c.cgcloud\_\_Compensation\_Model\_\_c.getDescribe().getName()) {
                ear.forRecordType(recordTypeId).Editable = false;
            }
            
            // EXAMPLE: SPC card is disabled for
            // specific Tactic RecordType id
            if (ear.Name == 'SPEND\_PLANNING\_CARD') {
               ear.forRecordType(recrodTypeId).Editable = false;
            }
        }
        
    }
}