GraphSQL —Native GraphQL support for the Salesforce platform

Build more efficient Salesforce integrations with our new free API extension

Elliott
Elliott
Aug 8 · 3 min read

GraphQL is an open-source database query and manipulation language, developed by the GraphQL Foundation. At it’s core a GraphQL query let’s you specify exactly what data is required, and in the structure and format that you want back.

With our new package, GraphSQL, you can add GraphQL support to Salesforce, allowing your integrations to be more efficient by being able to get data from several objects in a single request!


To give you an example, let’s take the following Salesforce SOQL query:

SELECT Id, Name FROM Account LIMIT 10

In GraphQL this becomes

{
Account(limit:10) {
Id
Name
}
}

This JSON-like structure is the format all GraphQL queries use, and one of the benefits of this is that you get back data from GraphQL in the exact same format.

This might not seem more useful right now, but let’s say you have a more complex scenario and you want to get all the Opportunities and Contacts for a specific Account, plus all the Tasks related to those contacts.

In SOQL you’d have to run multiple queries as you wouldn’t be able to nest that many relationships, but in GraphQL you can do it in a single request:

{
Account(limit:1) {
Id
Name
Opportunity {
Id
Name
Amount
}
Contact {
Id
FirstName
Task {
Subject
DueDate
}
}
}
}

You can see we’ve simply nested each of the child objects as a separate JSON-like object, with all the fields. This would retrieve us all the data we need in one request!

(If you want to test it out, you can head over to the Test Drive, open the GraphSQL Playground tab, and copy in this query!)


In Salesforce, if you wanted to get the data in the example above, you’d need to do multiple requests to the REST API, and there are limits on the number of API calls you can make a day. If we had GraphQL support, we could avoid this problem and make integrations more efficient by getting all this related data in a single request.

Enter GraphSQL — our new free package that extends the Salesforce REST API to include a new REST endpoint in your org, where you can send any standard GraphQL query, and using only one REST API call, get data from several objects back.


To make things even easier, the package also adds a playground into Salesforce, which is a page where you can test out different GraphQL queries without writing any code.

Test out GraphQL queries in real-time on your live Salesforce data

This makes it really easy to test out your queries on the platform before then adding them into your third party integrations.


GraphSQL is free to use and publicly available on the AppExchange!

(If you want to use GraphSQL in a scratch org, the Package Id is 04t4J000001O4O1)

We’ve also got a Test Drive available so you can go and use the playground without having to install anything.

Try it out today for free!

We’re always improving our free products and trying to make them as useful as possible for the Salesforce ecosystem, so we’d love to hear your feedback on it. You can reach out to us below or through our feedback form.


At Appitek, our aim is to help make your job easier, by creating simple but effective Salesforce applications that make you more efficient at what you do.

Appitek is a registered Salesforce ISV partner.
Salesforce and Salesforce Lightning are registered trademarks of Salesforce.com

Appitek

We build innovative solutions for business, using the best of modern capabilities and technologies. Behind all that? The power of Salesforce.

Elliott

Written by

Elliott

Multidisciplinary full stack developer, with a history in product & digital design. CTO at Appitek Ltd.

Appitek

Appitek

We build innovative solutions for business, using the best of modern capabilities and technologies. Behind all that? The power of Salesforce.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade