---
schema_version: "1"
id: 9ac9094fd75c92ab31b88149257f43b953a582f505254d76c6494033da5a3f8d
title: Define Custom Apex Class Logic to Create Associations
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/fsc_admin_assoc_engine_apex.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.fsc_admin_assoc_engine_apex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 2bf16d12264eb02a7ca26e5d5088ce9605a87d4816cfc345e74c9230a0b2c981
description: Record Association Builder gives you the flexibility to fully customize how association records are created by using a custom association handler Apex class.
products:
  - Financial Services
release: "264"
---
# Define Custom Apex Class Logic to Create Associations

Record Association Builder gives you the flexibility to fully customize how association records are created by using a custom association handler Apex class.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Professional</strong>, <strong>Enterprise</strong>, and <strong>Unlimited</strong> Editions</td></tr></tbody></table>

By default, Record Association Builder uses the Owner ID field on a standard or custom object when creating association records. You can specify a different ID field by selecting **Use an alternate owner ID** for the association criteria. The alternate owner ID field must link to a user or contact object that’s enabled for use as a Banker. If your custom object or alternate owner ID field doesn’t meet that requirement, you can program custom logic to create association records a different way.

Record Association Builder lets you specify a custom Apex class to handle the creation of association records for a specific association criteria. The custom Apex class must:

- apply to an object that isn’t directly supported the Record Association Builder;
- implement the fscwmgen.BranchManagementAssociationHandler interface;
- return a list of Branch Unit Related Records;
- populate at least the minimum required fields in each Branch Unit Related Record:
    - BranchUnitId: Represents the current branch unit of the user or contact
    - BusinessUnitMemberId: The Banker ID of the user or contact
    - RelatedRecordId: The ID of the custom object to be related

To specify a custom association handler Apex class for an association criteria:

1. On the New Criteria or Edit Criteria page, make sure that the **Use an alternate owner ID** checkbox is checked.
2. Specify the alternate ID field to use:
    1. Click the search box that says **Select a field on the reference object...**.
    2. In the **Select a Field** window use the filter control to find and select the ID field to use.
    3. Click **Choose** to select that field.
3. Click the **Use Apex class** checkbox.
4. Click the search box that says **Search Apex Classes...**. Specify an Apex class that implements the fscwmgen.BranchManagementAssociationHandler interface.
    
    ![Specify an alternate owner ID and Apex class handler](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-financial_services-264-0-0-production-enus/bbbfcd84-ccb2-4c2c-bf0e-04dbacfadfb4/financial_services/images/association_engine/fsc_rab_custom_apex.png)
5. Save your work.