---
schema_version: "1"
id: 39f98b565458659c04817bd537c018800036c3b04bb8d5562b0ab6a2066035e2
title: Create an Apex Class to Process Custom Personalization Information Input
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_dm_apex_class_to_process_cpi_input.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_dm_apex_class_to_process_cpi_input.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: b35b45d88778667b4a8b756ee483786bf5e1bdc17386db32e0201e9f2ace6411
description: For every Custom Personalization Interaction component that’s registered, you must provide an Apex class, which implements the Distributed Marketing (mcdm_15) BulkSendPlugin interface.
products:
  - Marketing
  - Cross Cloud
release: "264"
---
# Create an Apex Class to Process Custom Personalization Information Input

For every Custom Personalization Interaction component that’s registered, you must provide an Apex class, which implements the Distributed Marketing (mcdm\_15) BulkSendPlugin interface.

The Apex class you create must be global, and it must implement this getBulkSendPluginData method:

```
global static Map<String, Map<String, String>>
getBulkSendPluginData(List<mcdm_15.JourneyApproval> approvals
Map<String, String> pluginData)
```

This method takes a list of JourneyApproval objects and a map of the input plugin data. You then decide how to process that data. Here are some examples.

- You can have multiple CPI plugin components registered, each one using a different Apex class for processing.
- CPI plugins process in the order they’re registered.
- Each successive plugin has access to the processed value of the previous plugin. Therefore, you can build on the processed custom plugin data with each plugin in the chain.
- The same getBulkSendPluginData method is called when the Bulk Send or Auto Send job processes and when the personalization preview appears during the Bulk Send workflow. Currently, there’s no preview for the bulk custom plugin during an Auto Send workflow.
- Don’t execute DML in this method. If you do, it breaks the Bulk Send workflow.
- Governor limits apply. Bulk sends are batched in up to 500 members per batch. You can execute SOQL calls in this method, but they must be bulkified as in [these examples](https://help.salesforce.com/s/articleView?id=mktg.mc_dm_cpi_bulk_sends_examples.htm&release=264.0.0&type=5 "Use these common use case examples to guide your custom personalization interaction setup for bulk sends.").
- To avoid governor limit exceptions, use the Apex Limits class. Limits.getQueries() and Limits.getLimitQueries() help you determine if particular limits are close. We provide a custom exception called mcdm\_15.BulkSendCustomPluginException that can be used from this method. Error messages for this exception show on the personalization preview or the Bulk Send job or Auto Send job details after processing.
- If a governor limit is thrown during processing, the job fails. We have a transaction Finalizer that runs at the end of a Bulk Send or Auto Send job. If an error is found, the error message appears on the job details. The status for all relevant campaign members is reset to allow for resending, and you receive a notification in your org.