Set Up Heroku Connect
Set the unique identifiers for the DreamHouse app.
Currently, we have a properties listing on our DreamHouse app. This information is displayed only from the Postgres add-on we provisioned in the previous step. To see the properties you imported into your Trailhead Playground, we need to establish a connection between your Trailhead Playground and your Heroku Postgres database by creating mappings.
- In your Trailhead Playground, go to Setup and select Object Manager.
- Click Broker and select Field & Relationships.
- Click Email and click Edit.
- Select Unique and External ID.
- Click Save.
- Click the Object Manager tab. Scroll down and click Property.
- Select Field & Relationships.
- Click Address and click Edit.
- Select Unique and External ID.
- Click Save.
- Keep this tab open.
Add Heroku Connect.
- Go to your Heroku Dashboard, https://dashboard.heroku.com.
- Click your new DreamHouse dev app,
dhdev-UNIQUE_ID
. - Click Resources on the Heroku dashboard.
- In the Add-ons field, type
connect
. Select Heroku Connect and then click Provision. - After adding Heroku Connect, click Heroku Connect and it opens a new tab.
- Click Setup Connection.
- Click the schema name input and verify the text says
salesforce
, click Next. - Click Authorize.
- Using your Trailhead credentials we reset in Step 1, authorize your account.
- Click Allow.
Once you authorize Heroku to access your Trailhead Playground, you’re redirected to the Heroku Connect dashboard.
Create Heroku mappings.
- Click the Mappings tab and select Create Mapping.
- In the search bar, type prop and select Property__c.
- Select Accelerate Polling.
- Select Write data updates to Salesforce…. In the dropdown, select the unique identifier we set in our Trailhead Playground, Address__c.
- Select the checkbox for Address__c, Baths__c, Beds__c, Broker__c, City__c, CreatedDate, Description__c, Location_Latitiude__s, Location_Longitude__s, Name, Picture__c, Price__c, State__c, Status__c, Thumbnail__c, Title__c, and Zip__c.
- Click Save.
- Click Create Mapping.
- Type
brok
and select Broker__c. - Select Accelerate Polling.
- Select Write data updates to Salesforce… In the dropdown, select the unique identifier we set in our Trailhead Playground, Email__c.
- In the Mapped Fields section, check Created Date, Email__c, Mobile_Phone__c, Name, Phone__c, Picture__c, Title__c.
- Select Save.
- Click Create Mapping.
- Type
fav
and select Favorite__c. - Select Accelerate Polling.
- In the Mapped Fields section, check CreatedDate, Name, Property__c, User__c.
- Select Save.
- After you click save, you’re redirected to the Mappings tab.
Restart the app to poll Heroku Connect for new data.
- Return to the DreamHouse dashboard, http://dashboard.heroku.com.
- Click your DreamHouse app, for example,
dhdev-UNIQUE_ID
- Click More.
- Restart all dynos.
Verify the app is up and running.
- Click More.
- Click View Logs. Once the restart is complete, you should see two lines saying, State changed from starting to up.
- Click Open App to reload the running app. Take note of the DreamHouse URL in your browser, for example, https://dhdev-UNIQUE_ID.herokuapp.com/.
- Select the menu icon
and click Properties.
- Open the property titled Waterfront in the City.
- Scroll down and take note of the
Asking Price
.
Test Heroku Connect by changing the values in your Trailhead Playground
- Return to your Trailhead Playground. Click the App Launcher and select DreamHouse.
- Go to the Properties tab and select the Property Name, 211 Charles Street.
- Click the edit pencil next to Price to edit. Change the price to $800,000.
- Click Save.
- Navigate back to your DreamHouse app,
https://dhdev-UNIQUE_ID.herokuapp.com/
. - Select the menu icon.
- Click Properties.
- Open the property titled Waterfront in the City.
- Scroll down and see that the price changed to $800,000.