How to Develop a Custom CRM using only Low-Code Platforms
By: Sebastian Scholl
Tags: Development, Apps, Software Development, Productivity, Low Code

‍After that, we’re going to have to build a relationship between the Deals and TouchPoints table. This is because many TouchPoints can happen during the life of a Deal, and we’re going to want a has_many relationship to model that.

All you’re going to need to do is drag the Deals table over the TouchPoints table’s schema and drop it into the “Add New Field” input. This will wire up most of what’s needed automatically. What you’ll want to set manually are the following items.

Name the relationship “Deal” on the TouchPoints schema. Confirm that Allow multiple TouchPoints per Deal is checked in the relationship settings and not Allow multiple Deals per TouchPoint. Check the Deal field is Mandatory validation.

Building a relational data-model for custom CRM

Nice work so far! We’re going to speed it up now since you’ve already learned how to create tables, add fields, and build relationships between tables.

Our Deals table is going to be storing much more information. It’s serving as the main record in our CRM. Click over into its schema and try to add the following fields with the right types and settings!‍

Deals Table

email (type = Text, Field Size = 30, Mandatory = true)

(type = Text, Field Size = 30, Mandatory = true) stage (type = Switch, Format = Custom, Options = lead/opportunity/customer, Mandatory = true, Default Value = lead)

(type = Switch, Format = Custom, Options = lead/opportunity/customer, Mandatory = true, Default Value = lead) amount (type = Number, Decimal places = 2)

(type = Number, Decimal places = 2) deal_name (type = Text, Field Size = 100, Mandatory = true)

(type = Text, Field Size = 100, Mandatory = true) department (type = Text, Field Size = 100)

(type = Text, Field Size = 100) phoneNumber (type = Text, Field Size = 12)

(type = Text, Field Size = 12) TouchPoints (type = Table)

At this point, our data model is set up and our API is actually ready to use! Just for fun, let’s go ahead and add our first deal to the database using the GraphQL API.‍

Move over into the workspace API Explorer. This is a great environment for writing and testing your GraphQL queries, mutations, and subscriptions. However, you can always use another GraphQL client if you want, like GraphiQL or Postman. That said, if you set your tables up correctly, go ahead and run the following mutation to add a deal that already has 2 touch points.

mutation {

dealCreate(

data: {

deal_name: "Big opportunity at Big.co"

department: "Marketing"

email: "jake@big.co"

amount: 100000.00

stage: "lead"

touchPoints: {

create: [{ contactMedium: "Phone" }, { contactMedium: "Email" }]

}

}

) {

id

deal_name

createdAt

}

}

Since the API Explorer is embedded in the 8base console, it’s able to handle authentication for you. That said, to allow our Retool frontend to talk to 8base, we’re going to generate an API Token and assign it the necessary role.

Navigate to Settings > API Tokens and click the plus button. Name the token whatever you like, however make sure that you assign it the Administrator role! This will allow the Retool full access to our workspace tables.

Copy and paste the token value somewhere safe once you create it! It’s only visible once.‍

Create API Token for the custom CRM

Awesome! Our backend for the application is set up. It’s not time to go ahead and retrofit our frontend CRM template.

Setting up Retool with a GraphQL Resource and Custom CRM template

Retool allows you to connect to a crazy number of data-sources — both APIs and databases. Since 8base exposes a GraphQL endpoint, we’re first going to be adding a GraphQL Resource to our account.‍

Starting at the home screen of your Retool account, move to the Resources tab and click on the Create New button. You’re going to then scroll down to the APIS section and select the GraphQL option. Once open, it will prompt you for some information that we’ll add from our 8base workspace.

Name — “8base GraphQL Backend”

‍ Base URL — “YOUR_8BASE_WORKSPACE_ENDPOINT”

‍ Headers — key = “Authorization”, value = “Bearer YOUR_API_TOKEN”