salesforce-google-bigquery
salesforce-google-bigquery copied to clipboard
salesforce-google-bigquery
Apex and Lightning based integration with Salesforce and Google BigQuery.
Read this blog post to learn more about the demo.
Table of Contents
- Installation
- Installing the demo using Salesforce DX
- Installing the demo using an unlocked package
- Configuration
- Code Highlights
- Additional Resources
Installation
There are two ways to install Northern Trail Outfitters:
- Using Salesforce DX
- Using an unlocked package
Installing the demo using Salesforce DX
This is the recommended installation option for developers who want to experience the example and the code.
-
Authenticate with your hub org (if not already done):
sfdx force:auth:web:login -d -a myhuborg
-
Clone this repository:
git clone https://github.com/muenzpraeger/salesforce-google-bigquery cd salesforce-google-bigquery
-
Create a scratch org and provide it with an alias (bigquery):
sfdx force:org:create -s -f config/project-scratch-def.json -a bigquery
-
Push the app to your scratch org:
sfdx force:source:push
-
Assign the GoogleBigQuery permission set to the default user:
sfdx force:user:permset:assign -n GoogleBigQuery
-
Open the scratch org:
sfdx force:org:open
Installing the demo using an unlocked package
This is the recommended option for non developers. Use this option if you want to experience the sample app but do not plan to modify the code.
-
Sign up for a developer edition.
-
Enable My Domain. Follow the instructions to enable My Domain here.
-
Click this link to install the BigQuery unlocked package into your developer edition org.
-
Select Install for All Users. When prompted, make sure you grant access to the external sites (accounts.google.com and www.googleapis.com).
Configuration
After the installation you've to add your Google Service Account credentials to the Salesforce org. For that custom metadata types are used.
From the JSON file of your service account credentials you'll need the client_email value as well as the private_key value. Remove -----BEGIN PRIVATE KEY-----\n and \n-----END PRIVATE KEY-----\n from the private_key value.
- In Setup, type Custom Metadata Types in the Quick Find box and click Custom Metadata Types.
- Click Manage Records.
- Click New.
- Fill in the fields as described:
- Label: Google BigQuery
- Google_OAuth2 Name: Google_BigQuery
- Issuer: client_email value from JSON file
- PKCS8: private_key value from JSON file
- Save the record.
- Select BigQuery Demo in the App Launcher.
The Apex classes Futures and GoogleUiController have to be updated with your specific BigQuery project ID.