Skip to main content

From Lead to Customer Through a Sales Opportunity

In this tutorial, you'll experience a complete sales cycle from first contact to closed deal. You'll work with a prospective company, track a sales opportunity, and convert them into a paying customer. This is where CRM really shines — managing the entire customer journey.


Step 3.1 — Create a Lead

A Lead is a potential customer — an organization you're interested in doing business with, but haven't closed a deal with yet. Creating a lead is almost identical to creating a customer, just using a different relationship type.

POST/v1/odata/Relationship_Organization_CommercialRelationship_Lead

Save the ID from the response — this is the Lead Relationship ID you'll use to create the opportunity.


You need an employee to assign as the sales representative on the opportunity. Rather than creating a new one (employees cannot be deleted via the API), find an existing one.

GET/v1/odata/Relationship_Person_Contact_Employee?$filter=contains(Name,'chum')&$select=Name

Replace 'chum' with part of an employee's name in your environment. Save their ID for the next steps.

Creating employees is not recommended

Employees cannot be deleted via the API. Creating a test employee will leave permanent data in your CRM. Always use an existing employee for testing.


Step 3.3 — Get an Opportunity Phase ID

Before creating a sales opportunity, you need to choose its starting phase (e.g., Qualification, Proposal, Negotiation). Phases are stored in a Datastore.

GET/v1/odata/Datastore_Phase_ActivitySalesOpportunity?$filter=Code eq 'Qualification'&$select=Code

Save the ID of the Qualification phase.

What is a Datastore?

The Datastore contains all the dropdown values and predefined options used throughout Tribe CRM — phases, statuses, types, and more. They're read-only reference data that you reference by ID when creating records.


Step 3.4 — Create a Sales Opportunity

Now create a Sales Opportunity linked to Dunder Mifflin. A Sales Opportunity is an Activity — a trackable event in your CRM that moves through phases.

POST/v1/odata/Activity_SalesOpportunity

Save the opportunity ID from the response.


Step 3.5 — Update the Sales Opportunity (Close the Deal)

Great news — the deal progressed and you've closed the sale! Let's update the opportunity to reflect this win.

Updating uses a POST to the same endpoint (not PUT) and you only need to include the fields you want to change.

POST/v1/odata/Activity_SalesOpportunity

Step 3.6 — Convert Lead to Customer

Congratulations on closing the deal! Now let's convert Dunder Mifflin from a Lead to a Customer in your CRM.

In Tribe CRM, relationship subtypes from the same parent type are interchangeable — you can convert between them by changing the _Type field.

POST/v1/odata/Relationship_Organization_CommercialRelationship_Lead

Dunder Mifflin is now a Customer in your CRM!


Cleanup — Delete Created Entities

Now that you've completed the tutorial, let's clean up the test data.

1. Delete the Sales Opportunity

DELETE/v1/odata/Activity_SalesOpportunity({opportunityId})

2. Delete the Lead/Customer Organization

DELETE/v1/odata/Relation_Organization({organizationId})
info

Deleting the Relation_Organization also removes all its associated relationships (Lead, Customer, etc.).