Registering Strategies
The Three Fields
Strategies are registered via the callcoreio__ExtensibilityStrategy__mdt custom metadata type. Each record maps a strategy type and discriminator to an Apex class name.
| Field | API Name | Required | Description |
|---|---|---|---|
| Strategy Type | callcoreio__StrategyType__c |
Yes | Which extensibility point this record configures. Restricted picklist. |
| Discriminator | callcoreio__Discriminator__c |
No | Narrows which scenario this record applies to. See values per strategy below. |
| Apex Class Name | callcoreio__ApexClassName__c |
Yes | The unqualified name of your Apex class implementing the strategy interface. |
Strategy Type Values
| Picklist Value | Strategy |
|---|---|
BuildCommunicationScopeForRecord |
Build Communication Scope |
GatherPhoneNumbersFromRecords |
Gather Phone Numbers |
GetUserForCallHandler |
Get User for Call Handler |
RestrictCallHandlers |
Restrict Call Handlers |
RestrictSources |
Restrict Sources |
Discriminator Values
| Strategy | Discriminator to use |
|---|---|
BuildCommunicationScopeForRecord |
RecordType:<SObjectApiName> for object-specific (e.g., RecordType:Project__c); default for a catch-all |
GatherPhoneNumbersFromRecords |
RecordType:<SObjectApiName> for object-specific (e.g., RecordType:Supplier__c); default for a catch-all |
GetUserForCallHandler |
default |
RestrictCallHandlers |
default |
RestrictSources |
default |
The discriminator field is case-insensitive. RecordType:Contact and recordtype:contact resolve to the same record.
Class Name Resolution
Enter your class name without a namespace prefix. Incorrect class names, or class names that exist but do not implement the required interface, produce a CallCoreExtensibilityMisconfigurationException at runtime. Enable CallCore_DebugMode when testing to have this exception surfaced rather than swallowed.
Deploying via Metadata
To deploy strategy registrations as part of your org's metadata, add records to the customMetadata/ folder in your Salesforce project. File names follow the convention:
customMetadata/callcoreio__ExtensibilityStrategy.<DeveloperName>.md-meta.xml
The <DeveloperName> is a unique identifier for the record within your org.
Example: Single Global Strategy
Registering a custom GetUserForCallHandler implementation:
<?xml version="1.0" encoding="UTF-8"?>
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<label>Get User by Extension</label>
<protected>false</protected>
<values>
<field>callcoreio__StrategyType__c</field>
<value xsi:type="xsd:string">GetUserForCallHandler</value>
</values>
<values>
<field>callcoreio__Discriminator__c</field>
<value xsi:type="xsd:string">default</value>
</values>
<values>
<field>callcoreio__ApexClassName__c</field>
<value xsi:type="xsd:string">GetUserForCallHandlerByExtension</value>
</values>
</CustomMetadata>
File: customMetadata/callcoreio__ExtensibilityStrategy.Get_User_By_Extension.md-meta.xml
Example: Object-Specific Scope Strategy
Registering a BuildCommunicationScopeForRecord implementation for Project__c:
<?xml version="1.0" encoding="UTF-8"?>
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<label>Build Project Communications Scope</label>
<protected>false</protected>
<values>
<field>callcoreio__StrategyType__c</field>
<value xsi:type="xsd:string">BuildCommunicationScopeForRecord</value>
</values>
<values>
<field>callcoreio__Discriminator__c</field>
<value xsi:type="xsd:string">RecordType:Project__c</value>
</values>
<values>
<field>callcoreio__ApexClassName__c</field>
<value xsi:type="xsd:string">BuildProjectCommsScope</value>
</values>
</CustomMetadata>
File: customMetadata/callcoreio__ExtensibilityStrategy.Build_Project_Comms_Scope.md-meta.xml
Using Setup UI
Custom metadata records can also be created manually through Setup:
- Go to Setup → Custom Metadata Types.
- Find CallCore Extensibility Strategy and click Manage Records.
- Click New.
- Fill in the Label, Strategy Type, Discriminator, and Apex Class Name.
- Click Save.
Changes take effect immediately without a deploy.
One Record Per Strategy + Discriminator
Only one metadata record is permitted per StrategyType__c + Discriminator__c combination. If more than one record with the same combination exists, the framework throws CallCoreExtensibilityMisconfigurationException at runtime. Enable debug mode to surface this error.
Interaction with Packaged Defaults
A registered metadata record always takes precedence over the packaged default for the same discriminator. To revert to the packaged default, delete the metadata record — you do not need to deploy a new class.
If you register a default discriminator and also a specific RecordType:Contact discriminator, the RecordType:Contact record wins for Contact pages. The default record applies to everything else (unless overridden by another object-specific record).