Using Apex Code to Export Contacts to Golden
Last Updated: November 2025
Important Note: The Golden Salesforce integration repository is currently marked as LEGACY. Please contact your Client Strategist at support@goldenvolunteer.com to confirm whether this feature is still supported for your organization before implementing.
What This Feature Does
The Golden Salesforce application includes functionality that allows you to programmatically export Salesforce contacts to Golden and automatically assign them to specific Golden groups. This can be particularly useful when you want to automate volunteer exports based on specific criteria or triggers.
Before You Begin
1. Check Your Salesforce App Version
Make sure you have the Golden Salesforce app installed. The export functionality is available in current versions of the app.
2. Configure Your Integration Settings
In Salesforce, navigate to the Golden application and select the Settings tab. Scroll to the bottom of the settings page and verify that the export fields are populated.
To find these values:
- Go to your Golden dashboard
- Navigate to Settings → Integrations
- Click on the settings icon in the Salesforce integration box
- Copy the credentials and paste them into your Salesforce app settings
- Click "Save" — you should see a green confirmation box that says "Credentials Saved Successfully"
How to Use the Export Feature
The API Method
The ExportToGoldenBatch class in the goldenapp namespace provides a runSyncJob(List<Contact>, String) method that you can call from your trigger or action code.
Method Parameters:
- First parameter: A list of Contact records you want to export to Golden
- Second parameter: The name of the Golden group where these contacts should be added
The runSyncJob method schedules an asynchronous batch job to handle the export, so it won't impact your transaction limits.
Example Implementation
Here's an example showing how to create an Apex action that could be used in a Salesforce Flow. This particular example exports contacts who have a "Commercial License" checkbox selected:
global class ExportCommercialToGolden {
@InvocableMethod(label='Export Commercial License Holders To Golden' description='Exports contacts with commercial license to Golden' category='Contact')
public static List<Contact> exportCommercialToGolden(List<Contact> contacts) {
List<Contact> exported = new List<Contact>();
if ((contacts == null) || (contacts.size() == 0)) {
System.debug('No contacts');
return exported;
} else {
System.debug('There are ' + contacts.size() + ' contacts.');
}
for (Contact contact: contacts) {
if ((contact != null) && (contact.Has_Commercial_License__c == true)) {
exported.add(contact);
}
}
if (exported.size() > 0) {
goldenapp.ExportToGoldenBatch.runSyncJob(exported, 'Commercial');
}
return exported;
}
}
Need Help?
If you have any questions about implementing this feature or run into any issues, please email us at support@goldenvolunteer.com.