Update: DriveWealth used to offer access to its open, “front office” API’s for free. Since then, they’ve pivoted to a B2B2C model and work only with regulated counterparties. Because of that change code, APIs and links mentioned in this blog do not work anymore. The architectural approach is still valid and can be applied to another API integration.

This is the second installment of our blog series that focuses on building apps on Financial Services Cloud. In our first installment, we gave background on Financial Services Cloud and showed why customers and ISVs should build apps to extend it. In this article, we get hands-on with a use case and show you how to extend Financial Services Cloud with custom functionality to connect with the DriveWealth open API.

Project objectives

  • Integrate with a third-party open API (DriveWealth)
  • Build Lightning components to extend base Financial Services Cloud UI
  • Build object-oriented, reusable, extensible code
  • Build secure and scalable code
  • Build a sample extension package on Financial Services Cloud

Application architecture

As illustrated in the architecture, the primary user personas are financial advisors; system administrators who are regular Force.com users; and the end customers, who can be the investors or household members advised by the financial advisor. These end customers can be customer community users.

We progressively build out the managed package components as we go through this project.

What exactly is DriveWealth ?

DriveWealth is a mobile investing platform for young investors. It specializes in investing in fractional shares. For more details, visit https://drivewealth.com.

DriveWealth provides a free open API for developers supporting REST and FIX (financial info exchange) APIs. In our sample project, we use the DriveWealth REST API to integrate with Salesforce.

Project use cases and DriveWealth APIs

For the first phase of this project we focus on the following use cases for the financial advisor user persona:

  • Create a DriveWealth account (practice account)
  • Search for a ticker symbol for a stock
  • Place a market order for a stock
  • Get the market order status

Some of the DriveWealth APIs that we use for these use cases include:

Prerequisites

  • Salesforce Developer org with Financial Services Cloud installed:
    • Sign up for a free Developer Edition. Partners can create a new Partner Developer Edition from their business org. (ISV partners can reach out to their partner account manager to get access to Financial Services Cloud.)
    • Prepare your Developer Edition for Lightning component development (enable My Domain and Deploy to Users).
  • Financial Services Cloud installation is configured correctly. Follow the instructions closely in the quick start guide to configure the org and create the requisite profiles.
  • DriveWealth account setup for development. Send an email to partner@drivewealth.com to set up your account.
  • Familiarity with development of Lightning components
  • Familiarity with Apex development and callouts

Demo

To take a look at how the application looks, review this brief video.

Tools and frameworks

We use the following frameworks to make our lives a bit easier. Note that these are the individual choices of the authors of this blog and not an endorsement by Salesforce.

Implementation details

Use Case 1: Create a DriveWealth Account

The sequence diagram provides a high-level illustration of the interaction between the various components of the application.

Lets look at the code for this use case. All the source code is available on GitHub. Here are the relevant code components:

  • DemoApp.app application:
    • This stand-alone app container facilitates testing of components without having to use one.app container and load the entire Lightning Experience interface.
    • The DemoApp loads DriveWealth account information on initialization.
  • DWCreateAccountForm.cmp:
    • The component that collects the information needed by the DriveWealth API to create a DriveWealth practice account, including first name, last name, user name, and password.
    • This DriveWealth account is needed for creating market orders.
    • This component invokes the the JavaScript controller DWCreateAccountFormController.js and the associated helper JavaScript class DWCreateAccountFormHelper.js, which in turn invokes the Apex controller class DWCreateAccount.cls.
  • DWCreateAccount.cls:
    • The controller class that prepares the DriveWealth account and makes the callout to the DriveWealth API to create the DriveWealth account.

Design patterns and usage

The Create DriveWealth Account use case employs the excellent design pattern framework designed by Andres Perez.

This pattern helps manage the communication between Lightning components and Apex:

This illustrates the reusability of this pattern.

As an example in this project, the createAccount function (DWCreateAccountFormHelper.js file) of our component finds and invokes the component ETLC_ApexBridge.cmp, which in turn invokes the “execute” method in the class ETLC_ApexBridge_Controller.

The execute method uses reflection to determine the class to be instantiated at runtime and executes the process method.

In this case, the class instantiated is our Apex controller DWCreateAccount.cls, and the corresponding process method is invoked.

This pattern can be used by any component that you write in your project. This pattern helps you cut down the amount of code to write invoking controllers from components.

Whats next in this blog series

In the next part of this blog series, we explore the other use cases of the project. We also dig a little deeper into the usage of the ESAPI library to make our code secure to help pass the Salesforce security review. In addition, we provide details on the logging mechanism used and provide some insight into what we will work on next as we continue augmenting the project.

Summary

In this article, you learned how to extend Financial Services Cloud by creating your own component to integrate with a third-party open API. You have access to our entire codebase on GitHub. Get it, experiment with it, and post your questions/comments below.

The Blog Team Behind This Series

Vydianath Iyer
Jaswinder Rattanpal

Related links

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS