Lead Subscription POST
The logic to submit HTTP POST requests to the BankingBridge API subscription endpoint is initiated through a trigger that resides on the Lead BB_LeadTrigger.trigger
. This trigger runs logic within the BB_LeadTriggerHandler.class
which utilizes a standardized trigger handling class BB_TriggerHandler.class
according to a Salesforce best practice.
The trigger handler class executes logic After Lead Insert and After Lead Update.
The following pseudocode describes the logic used on Lead insert and update to execute an HTTP POST request to the BankingBridge API subscription endpoint:
- On lead insert: If the API Key custom setting is not blank and the Lead Email is not blank and the Lead NMLS or LOID is not blank and the Lead Credit Score is not blank and the Lead Loan Amount is not blank and the Lead Property Value is not blank and the Lead Subscription ID is blank, execute a POST to the subscription API endpoint.
- On lead update: If the API Key custom setting is not blank and the Lead Email is not blank and the Lead NMLS or LOID is changed and not blank and the Lead Credit Score is not blank and the Lead Loan Amount is not blank and the Lead Property Value is not blank and the Lead Subscription ID is blank, execute a POST to the subscription API endpoint.
A post to the BankingBridge API subscription endpoint is initiated by passing the lead to the BB_BankingBridgeAPI.class
which executes the sendSubcriptionData()
method asynchronously.
The sendSubcriptionData()
method serializes the lead into a JSON object defined within BankingBridge API Reference . The serialization method also removes NULL values replacing them with blanks.
Next the method executes a post to the endpoint defined within the BB_BankingBridgeAPI_CONSTANTS.class
including the API Key
ENDPOINT_SUBSCRIPTION = 'https://api.bankingbridge.com/subscription';
The response status from the POST is captured in the BB_Last_API_Sync_Status__c
custom field located on the lead.
Updated 10 months ago