Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This topic documents how to get started with the Apex SDK, and links to reference information on all of the supported features.LaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | Apex server SDK |
| GitHub repository | apex-server-sdk |
| Sample application | Apex |
| Published module | None |
Get started
After you complete the Get started process, follow these instructions to start using the LaunchDarkly SDK in your Salesforce Apex application.Deploy the SDK to Salesforce
The first step is deploying the SDK to Salesforce:Initialize the client
Initialize the client as follows:LDConfig.Builder.
Evaluate a user
You can use theVariation methods available from the client to check which variation a particular user will receive for a given feature flag.
Here’s how:
Use the Launch
Darkly Salesforce bridge The Apex server-side SDK is architected differently than our other SDKs. In most of our SDKs, the SDK downloads feature configurations and sends events by itself. The Apex SDK instead uses an external bridging application to connect LaunchDarkly and Salesforce. Because the SDK uses a bridge to handle state management, there is no initialization delay required to download flags. Additionally, the lack of state inside the SDK means that initializing multiple instances of the SDK is not problematic. The Apex SDK exposes two HTTP endpoints that the bridge uses:/store and /event. The bridge pushes flag updates to Salesforce through one endpoint, and pulls events from Salesforce with the other.
Install the bridge
The bridge is designed to be run as a daemon on your server infrastructure, either with a cloud provider or your own on-premise infrastructure. The bridge is a Go application configured with environment variables. To build the bridge from source install Go 1.14 or higher. To install Go, read Go’s documentation. The bridge needs authorization for both LaunchDarkly and Salesforce.The Apex SDK uses an SDK key. Keys are specific to each project and environment. They are available from Project settings, on the Environments list. To learn more about key types, read Keys.