Create a named credential in Setup to store the external endpoint URL and authentication, avoiding hardcoded URLs or credentials in Apex code
Write a future method (or Queueable Apex class) annotated with @future(callout=true) that accepts primitive arguments — Apex triggers cannot make synchronous callouts
Inside the future/Queueable, construct an HttpRequest using the named credential as the endpoint prefix (callout:MyNamedCredential/path) and set appropriate headers and JSON body
Call HttpClient.send() and inspect HttpResponse.getStatusCode(); throw a custom exception for non-2xx responses to trigger retry logic or alerting
In the trigger, collect the relevant record IDs and field values, then invoke the future/Queueable asynchronously — do not pass SObject instances directly
Add a try/catch around the enqueue call in the trigger to handle the AsyncException that fires when the async queue is full (governor limit: 50 future calls per transaction)
Known gotchas
Future methods cannot be called from batch Apex contexts; use Queueable with AllowsCallouts interface instead when the trigger fires inside a batch operation
Callouts within a transaction that has already performed DML require the callout to run asynchronously — mixing synchronous callouts with DML in the same transaction throws a System.CalloutException
Named credential merges formula fields into the endpoint path at runtime, which is powerful but can produce a malformed URL if the formula references a null field — validate inputs before building the path
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp