How to view Namara data
on your Salesforce dashboard

Written by Chris Sandison

March 27, 2017

What’s really behind this post is the exciting news that Namara API now supports OData Version 4.0! Since each data set is offered as it’s own OData Service, you can use the query capabilities of any OData-compliant client to view external data in real time. Though this post will focus on getting up and running with Salesforce, you can use the service endpoints mentioned bellow for comparable .NET or SAP services.


Step 1: Retrieve your Namara API Key

After logging into your Namara Account, click on your user icon in the sidebar (bottom left of the window) and select Account SettingsThen click the API Key tab.

You will need to create an API key if you have not already done so. Otherwise, retrieve the one that you have already created and paste this somewhere where it can be accessed. You will need to use it a few times.

Step 2: Find the data set you would like to add

Navigate to the data set of interest. In the top bar, click on the API Info tab, to view integration information. Copy the contents of the API Endpoint field into somewhere where you can access it later.

Step 3: Adding a new External Data Source to Salesforce

On your Salesforce Lightning dashboard, access “Setup” in the top toolbar.

Either enter “External Data Source” in the Quickfind bar, or navigate Data > External Data Sources in the sidebar under the “Administration” header. Then click the “New External Data Source” button.

In the form, fill out the following fields:

  • External Data Source: give this a name to refer to the data set that you are adding a view for.
  • Type: Salesforce Connect: OData 4.0 (Please note that 2.0 is not supported by Namara)
  • URL: paste the API Endpoint url that you copied from before, then add “OData.svc/” to the end, so that it looks like this:

https://api.namara.io/v0/data_sets/:data_set_id/data/:version/OData.svc/

  • Identity Type: Per User
  • Authentication Protocol: Password Authentication
  • Administration Username: Set this to whatever you want. This field will not be used for verification and will be ignored.
  • Administration Password: Paste your API Key here.

The form should look like this:

Now click “Save”. You will be taken to a screen to review the details. If you are satisfied, click “Validate and Sync”.

Salesforce will access a specific metadata endpoint for this data set and model the external data as Salesforce objects. If successful, you will be shown a table of all External objects found. Only the table named “Data” is necessary for viewing. After selecting that, click “Sync”.

If you go back to the Setup sidebar and view your “External Data Objects”, you should see one called DataDataSets and Versions only store metadata and aren’t required for viewing. You can edit this object to enable reporting. I recommend changing the label to something more descriptive like “HamiltonSchool”, but do not change Object Name.

Click “Save” when you are finished.

Step 4: Grant User Permissions for Viewing

In the sidebar, navigate to “Profiles” and find the profiles of whatever user will be accessing this data. Click “Edit” for the profile and ensure that External Object Permissions are set for this external source.

Then under Enabled External Data Source Access, click “Edit” and grant access for your external data source.

Next you need to store the access credentials for this data set so that the API Key can be used on subsequent access calls. To do this, click on your user icon in the Top Right corner and then click “Settings”. You will be taken to another page with a Sidebar & Quickfind text field. Click on the tab labelled “Authentication Settings For External Systems” and then click “New”.

Fill out the form with access credentials for a user.

Step 5: Create a Tab

In your Sidebar Quickfind, search for “Tabs”, then create a new Custom Object tab. Select the External Object by the label that you added in Step 3 and add an icon style. Click “Next”. Set visibility for Tabs however you would like.

Step 6: Create a View

Navigate to the tab that you created in Step 5. When you click “Go!” you’ll notice that these aren’t the fields you are looking for.

NOTE: We do not give API-level access to a single row in a data set, so accessing Display URL will give you an error.

 

Create New View

You will have to create a new View and use $filters and $select statements in order to pull out the data. Start by clicking the “Create New View” button.

Create whatever query you would like on the data. Here, I am trying to view all high schools with enrolment over 500.

When selecting fields to display, ignore _row_id — it’s just a unique key we use so that the OData adapter can tell records apart.

Since there are a maximum 15 fields for a view, it’s more manageable to create several meaningful views rather than a single one that attempts to read the entire data set.

Now when you click “Go!” you will see the fields from your view, and be able to step through the paginated results.

There you have it! I apologize for switching between the old Salesforce interface and the new Lightning dashboard, but I was informed that the new lightning dashboard did not support filter views (yet).

 

Finished project

Please get in touch if 

  • Things in the tutorial are unclear, or you have recommendations for improving the flow of this post
  • You’ve been able to do some neat things using Namara & OData. We would love to hear about it!