The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Must-read

Loading central bank exchange rates into Salesforce with Apex batch Jobs (opens in a new tab)

You will learn why DatedConversionRate cannot be written with Apex DML, how to convert a bank's rate table into your corporate currency, and how to schedule a callout-based sync with the right credentials.

Why read this

The post also lists setup errors that waste time.

  1. Scheduled Apex starts a batch job
  2. One GET to the rates API
  3. One REST write per currency
  4. Failures make the job fail
The batch sync runs one table per execute, with a single rates GET and then one REST write per currency

Salesforce multi-currency uses whatever rates are maintained under Manage Currencies, and it does not fill them in. Orgs often update rates by hand, so they drift from the figures finance books in the ERP. When a specific institution’s rate is required, such as the ECB or the Fed, a scheduled job can load the table and date each rate with the day the bank published it.

The post explains that DatedConversionRate cannot be written with plain DML and must be written through the REST API, which means an in-org job calls its own REST endpoint from Apex using a Named Credential. Salesforce closes the previous date range automatically, so the job must query for an existing row with the same StartDate and update it rather than insert a duplicate. Rates are stored as units of the currency per one unit of the corporate currency, and the post gives a formula for converting any bank’s table from its home currency into the corporate currency’s basis.

The post also covers the credential setup for both the rates API and the org’s own REST API, including External Client App steps, and lists pitfalls such as an empty Scope value and redacted tokens. For scheduling, Scheduled Apex cannot make callouts, so the schedulable starts a batch job with scope 1, and write failures should be made to fail the job so they appear under Apex Jobs. The author reports test results from a Developer Edition org and offers a Python alternative for teams that already run cron or CI jobs.

Read the original at dev.to (opens in a new tab)

Worth reading?

Recommended

Route a voice agent's Salesforce calls through a small endpoint you control (opens in a new tab)

You will learn why a token-renewing middle endpoint suits a voice agent that cannot refresh OAuth tokens itself, how to set up a client credentials External Client App with a locked-down integration user, and how to log call results as Tasks without duplicates.

  1. Agent sends request with bridge key
  2. Endpoint attaches cached Salesforce token
  3. Salesforce returns success or error
  4. Endpoint passes reply back to webhook
  5. Webhook retries temporary failures
How a call result reaches Salesforce through the endpoint

The author treats Salesforce’s reply as the only proof that a call reached the CRM, so any non-success reply should trigger a retry. Because the Salesforce client credentials flow issues short-lived tokens with no refresh token, and the Dograh voice platform stores credentials only as fixed values, the design places a small HTTPS endpoint between the agent and Salesforce. That endpoint holds the Salesforce secret, caches tokens, and checks a fixed bridge key header before doing anything else.

The token logic fetches a token, reuses it, and on a 401 response fetches a fresh one and retries once, so nothing downstream has to handle expiry. For setup, the article recommends starting with an External Client App, since new Connected Apps are restricted from Spring ’26. It advises enabling OAuth and the client credentials flow, running the app as a dedicated integration user with the Minimum Access - API Only Integrations profile, and granting only read on Contacts and Leads plus create on Tasks.

For inbound calls, a pre-call data fetch can search Contacts and Leads by phone number before the agent speaks, matching on the last 10 digits to handle inconsistent formatting. The author warns to keep this fast and to confirm identity with an approved check before using any Salesforce data. After the call, a webhook files a Task on the matched record, with TaskSubtype set to Call at creation since it cannot be changed later. Retries can file duplicates, so the endpoint should track the run_id of filed Tasks and skip repeats. The article closes with testing advice: check View Trace after a live call, and test an unknown caller.

Read the original at dev.to (opens in a new tab)

Worth reading?