Go back to 8base Academy
October 1, 2019

Salesforce Integration exposed through GraphQL API

GraphQL Queries
Sebastian Scholl

* This is an automated transcript. Please excuse inaccuracies.

Hi everyone, I'm really excited be sharing today the Salesforce integration with you which we've been working really hard on. And I'd say that let's jump right into it and look at how we can start building data-driven applications that utilize both Salesforce and 8base data.  


So, starting in my workspace home I'm going to navigate over to the data builder and then we can add external data sources as a table right. So, if we go to click “external data” source we have an option which is now the Salesforce integration and clicking that we can select “to create the integration”. If you wanted to rename it you could, but we'll just leave it with the default Salesforce. Now that that integration is added I'm going to have to go log in to my Salesforce account. To log in let's just click “connect”. It is going to ask you to authenticate to your Salesforce account. I have a Salesforce Developer account, though if you had access to Salesforce data through your Salesforce instance you could log into that account as well. So, let me just enter my Salesforce credentials and it'll bring me back to the 8base app.  


So, essentially what's happening right now, it is pulling in your data schema from the Salesforce take a look at all the tables you have on your Salesforce account. And by default, that's like over two hundred and fifty something tables and if you'd customized your Salesforce farther that will include your customized tables. However, once it's pulled those in as we can see that's done here with that success message let's click on “add tables”.  


So, now back in our data builder we see that there's this new section over on the right left-hand side which is Salesforce and from it we have four tables which is, account, contact, lead and opportunity. If we were to click, “select tables”, we go through all the different tables that we have stored in Salesforce right and then select one of those to import it. For example, order, product, feed. I select it, it's going to add the table two to my 8base workspace.  


So, we can see here all the data that's stored or all the field types that are stored on the table, as well as the data types that they're stored as. And if we wanted to, we could even add custom fields to these tables which is pretty cool. However, what I want to show is that for example in this application let's say that we have brokers and brokers have leads. We could say a broker has many leads, so let's allow multiple leads for her broker cool and then create that relationship right. So, what's really neat about that is, now we have two different tables, one table in 8base that's really to another table in Salesforce right and we can query that already through our graph QL API.  


So, just for fun what I'm going to do is I'm going to go to my brokers and I'm going to edit this first record. And I'm going to say, “Hey, it has a few different leads. The Salesforce account added some dummy data or seed data to my developer account, so I already have some records in there.” So, I will submit those changes. Then I'm just going to show the ID, so I can look up this broker awesome and now let's jump over to the API Explorer.  


Okay so now what we're going to do is we're going to look up that broker, so let's do a query. And let's look up that broker by their ID okay. I got a string. What I got here? Oh, there we go. Awesome! So, now if we wanted to, we could see that, hey there's all these different fields on the broker. Let's just return the lead- it would be lead, so let's update the name of that relationship. So, if we go back to broker and we say, “Broker has many leads.” Cool that makes more sense. Awesome! Now we go back here so now we say that they have many leads cool. And on that we want to know how many leads they have and then for each lead they have we want this data which is the name and the title and the company once again, all of which is stored in Salesforce. So, let's run this query and that's exactly what we got back right.  


So, remember this query could be executed against your workspace in point now so no matter what client application you are building, you now have a unified access to both the data stored in 8base as well as the data stored in Salesforce. And of course, if we wanted to, we wouldn't have to go through that table that we had created in 8base which is the broker’s table. What I mean by that? So, for example let's write another query we were to say hey this query is going to be a lead list right and for every lead that there is. One second, let me fix that. So, there's a count of leads and then for every lead there is which is stored under items, we want- oh here in one second, you got the wrong leads table.  


So, let's go to Salesforce that's a namespace there. Then in Salesforce we had a lead list- cool. And if I fix that there. All right now when we look at the fields that are on the lead table, we can say, “Hey, we want the last name and the first name.” Alright do that and now we see all the leads that we have stored in our Salesforce account right.  


So, right now this integration is a read-only integration, so you are only able to query it however we are soon to release the ability to also push updates to the Salesforce data. So, this opens a really seemingly infinite range of possibilities for application that you could develop right. So, whether or not you're working with a client that has Salesforce or uses Salesforce in their business and you could develop custom applications for them or you have access to your own Salesforce data, and would like to use it or expose it in different ways. This is probably one of the easiest to use Salesforce APIs available on the market.  


So, thank you so much for watching. I hope this was interesting to you. If you have any questions, please feel free to leave comments in the video and we will be updating the documentation shortly. Thank you.

Share this post on social media!

Ready to try 8base?

We're excited about helping you achieve amazing results.