Skip to content
Home » Truckstop

Truckstop

Truckstop Integration Guide

Streamline your load posting workflow with one-click posting to Truckstop and visibility into posted loads directly inside FTM.

Overview

The Truckstop integration allows FTM users (primarily carriers/dispatchers) to:

  • Post an FTM load to Truckstop from inside Salesforce/FTM.
  • View a list of Truckstop loads from within the same interface.
  • Support both real API mode (via Named Credentials) and mock mode (for development/testing).

This integration connects FTM with Truckstop via a Salesforce Named Credential (Truckstop_Integration_Credentials) to securely call Truckstop endpoints using HTTP callouts.

1⃣ User Information: What This Integration Does

Purpose

The Truckstop integration enables dispatchers to post loads to Truckstop without leaving FTM and immediately confirm success/failure. It also provides an embedded list of available Truckstop loads for quick reference.

Truckstop workflow for carriers in Freight Transportation Manager _ FTM TMS _ Transportation Management Systems
Truckstop workflow for brokers and shippers in Freight Transportation Manager _ FTM TMS _ Transportation Management Systems

User Workflow

  1. Dispatcher opens a Load record in FTM (Salesforce).
  2. Dispatcher clicks “Post Load to Truckstop”.
  3. System sends the load payload to Truckstop using an API callout.
  4. System displays a success or error message in the page.
  5. System refreshes the Truckstop Loads table to show the latest list.

Key Features

  • One-click posting of a Load to Truckstop from FTM.
  • Uses Named Credentials for secure authentication and endpoint management.
  • Displays a live (or mock) Truckstop load list in a Visualforce UI.
  • Supports mock mode when credentials are not configured (safe for dev/test).

2⃣ Developer Information: How It Works in Salesforce

Apex Components

ComponentPurpose
TruckstopIntegrationCore integration class that posts a load and fetches load list from Truckstop
TruckstopVFControllerVisualforce controller extension that posts load + loads Truckstop list
Visualforce PageUI button to post load and table to display Truckstop loads

1. API Integration

A) Named Credential

The integration expects a Named Credential with the exact name:

Truckstop_Integration_Credentials

This Named Credential is referenced in callouts like:

  • callout:Truckstop_Integration_Credentials/submit
  • callout:Truckstop_Integration_Credentials/loads

Where it is used

  • POST /submit → submit a load to Truckstop
  • GET /loads → fetch list of Truckstop loads

Note: /loads endpoint is currently used as a “list loads” endpoint assumption in code.

B) Real Mode vs Mock Mode

The code determines whether the account is “active” by checking:

Schema.getGlobalDescribe().containsKey(‘Truckstop_Integration_Credentials’);

  • If it evaluates to true → real callouts execute.
  • If it evaluates to false → mock responses are returned.

Mock responses

  • Post Load returns:
    • SUCCESS (MOCK):
      {"result":"success","truckstopLoadId":"TS-MOCK-123"}
  • Load list returns two sample items:
    • TS-MOCK-123 / Mock Load 1
    • TS-MOCK-124 / Mock Load 2

2. Apex: Posting a Load

Method

TruckstopIntegration.postLoad(FreightTM__Load__c load)

Endpoint

callout:Truckstop_Integration_Credentials/submit

Request

  • Method: POST
  • Header: Content-Type: application/json
  • Body: JSON.serialize(load)

Response Handling

  • If HTTP status is 200:
    • returns: SUCCESS (REAL): <body>
  • Otherwise:
    • returns: ERROR (REAL): <body>

This returned message is displayed to the user in the Visualforce page via ApexPages.addMessage().

3. Apex: Fetching Truckstop Loads

Method

TruckstopIntegration.getTruckstopLoads()

Endpoint

callout:Truckstop_Integration_Credentials/loads

Request

  • Method: GET

Response Handling

If status is 200, the integration expects a JSON response shaped like:

[
  { “id”: “…”, “name”: “…” },
  { “id”: “…”, “name”: “…” }
]


It parses the list and maps each row into:

  • id
  • name

Returned type:
List<Map<String,String>>

4. Visualforce UI

Visualforce Controller Extension

TruckstopVFController

Behavior

  • Loads the current Load record from standard controller.
  • On page load:
    • calls TruckstopIntegration.getTruckstopLoads()
  • On “Post Load” button click:
    • calls TruckstopIntegration.postLoad(load)
    • shows message
    • refreshes the Truckstop loads table

Visualforce Page

Features

  • Button: Post Load to Truckstop
  • Table: Truckstop Loads (Load ID + Load Name)
  • Page messages region for success/error text

5. Field Mapping

Current Implementation

The integration posts:

  • JSON.serialize(load) (the full FreightTM__Load__c record)

Implication
Truckstop must accept the Salesforce Load JSON shape, or your Named Credential endpoint must point to a middleware that translates Salesforce fields → Truckstop’s expected schema.

If Truckstop requires a strict schema, you should implement a mapping layer similar to DAT (build a request Map and serialize that instead of serializing the whole sObject).

6. Error Handling

ConditionOutcome
Named Credential missing / not configuredMock response is returned (safe dev mode)
HTTP status != 200User sees “ERROR (REAL): …”
GET loads fails / non-200No loads added (table may show empty or mock list depending on mode)

7. Testing & Deployment

A) Mock Mode (no Named Credential)

  1. Deploy code and Visualforce page.
  2. Open any Load record.
  3. Click Post Load to Truckstop.
  4. Confirm:
    • Success message shows mock Truckstop load ID
    • Loads table shows two mock loads

B) Real Mode (Named Credential configured)

  1. Create Named Credential:
    • Name: Truckstop_Integration_Credentials
    • URL: Truckstop API base (or middleware base)
    • Auth: per your Truckstop setup (OAuth/basic/token/etc.)
  2. Open a Load record and click Post Load to Truckstop.
  3. Verify:
    • HTTP 200 returns “SUCCESS (REAL)”
    • Table refresh shows real load list (assuming /loads endpoint returns expected JSON)

FAQs

Q: Does this integration support updating or deleting Truckstop postings?
Not in the current code. It supports posting and listing loads only.

Q: Can we filter Truckstop load search like DAT?
Not implemented here. The current GET /loads fetches whatever the endpoint returns.

Q: Why is there a mock mode?
To allow development/testing without credentials or real API connectivity.

Q: Where is authentication handled?
By the Salesforce Named Credential, keeping credentials out of Apex code.


Support

For setup help or troubleshooting, email: [email protected] 

Leave a Reply

Your email address will not be published. Required fields are marked *


Let's Talk!

Thanks for stopping by! We're here to help, please don't hesitate to reach out.

Watch a Demo