Recommended
Write a metric contract before giving an AI agent access to CRM and ERP data (opens in a new tab)
You will learn why the same business metric can differ across Salesforce and an ERP, and how a versioned metric contract naming one source of truth and owner per number prepares data for an AI agent.
Won opportunities
- Sums Amount on Opportunity
- Filters on IsWon and CloseDate
- Measures closed deals this month
Activated orders
- Sums TotalAmount on Order
- Filters on Status and EffectiveDate
- Measures orders effective this month
A sales manager asking for one figure often gets three answers: the CRM, the ERP and a spreadsheet each record a different moment of the same sale. The author says this is common in mid-sized companies running Salesforce beside a separate ERP, and that an AI agent given access without resolving it will simply pick one number.
The piece illustrates the problem with two valid SOQL queries for sales this month: one summing won Opportunities by close date, the other summing activated Orders by effective date. Both are correct and can return different totals on the same day, while invoicing in the ERP follows its own date logic.
The proposed fix is a metric contract, a short versioned YAML file. For each metric it names the question, the definition, the source of truth, the object and filter, the amount field, an owner, what the metric is not, and any metrics it reconciles with along with the expected gap. The example pairs a sales_this_month metric on the Order object with an invoiced_this_month metric held in the ERP.
The author’s practical rules are to give the agent the contract as context rather than only database access, to flag metrics that depend on spreadsheets as candidates for removal, and to review the contract when processes change, as one would review code. The article also notes that a single data source avoids much reconciliation work, and it promotes the author’s own ERP product built natively on Salesforce.
Read the original at dev.to (opens in a new tab)