# CRM Management

The Magento CRM screen is a customer selection and reporting feature. It reads Magento customer, order and communication-preference data to help staff find and manage relevant customers.

It does not replace Magento newsletter consent or Dotdigital. Newsletter status remains the email consent signal, while Dotdigital is the delivery and automation platform.

## Admin location

The Magento admin menu exposes the feature as **Customer Relationship Management**. It is also labelled **User Relationship Management** under the Email Connector menu.

## Available customer information

The CRM grid supports customer details and business metrics such as:

- Customer ID, name, email and telephone
- Assigned sales representative
- Website
- Projected sales value
- Purchases matching the selected filters
- Do Not Contact status
- Email promotion preference
- Investment research preference
- App promotion preference
- WhatsApp promotion preference

Selecting a customer can display a more detailed customer view.

## Filters, exports and lists

Staff can combine the CRM filters to create a customer audience. The filtered result can be exported as `CustomerEmails.csv`.

Filter results can also be saved as Marketing Lists. The saved list stores the resolved customer IDs so it can be reused by the marketing-list functionality.

## Access control

Access is restricted in application code to:

- Selected administrator, developer and trader roles
- One explicitly configured admin user
- Admin users marked as sales representatives

Sales representatives can be further restricted to customers assigned to sales reps in their configured sales-rep groups.

## Relationship with newsletter and Dotdigital

- The CRM uses Magento customer data to build and export audiences.
- Newsletter consent comes from `newsletter_subscriber.subscriber_status` and related customer preferences.
- Dotdigital receives eligible contacts through scheduled connector exports.

See [newsletter.md](newsletter.md) for subscription handling and [dotmailer-dotdigital.md](dotmailer-dotdigital.md) for contact synchronization.

## Troubleshooting

1. Confirm the admin user has an allowed role or sales-rep configuration.
2. Check whether sales-rep group restrictions are excluding the customer.
3. Clear or simplify grid filters to identify which condition excludes the customer.
4. Verify the customer website and communication-preference values.
5. Check newsletter status separately; being visible in CRM does not automatically mean the customer is subscribed.

## Key implementation files

Paths are relative to `web-root/`.

- `app/code/local/Cru/Reports/controllers/Adminhtml/CustomerController.php`
- `app/code/local/Cru/Reports/Helper/RelationshipManagement.php`
- `app/code/local/Cru/Reports/Block/Adminhtml/Customers/RelationshipManagement/Grid.php`
- `app/code/local/Cru/Reports/Block/Adminhtml/Customers/RelationshipManagement/Details.php`
- `app/code/local/Cru/Reports/etc/adminhtml.xml`
