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.
  • 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.