Back to Playbooks

Lead-to-Account Association Engine

BlueprintBuild
~45 min

Design and deploy a complete lead-to-account matching configuration. Architect discovers your current Lead and Account schema, generates bounded specs for match scoring fields, domain-based matching rules, and permission sets — then deploys through sandbox verification.

The Prompt

We need to build out our lead-to-account matching from scratch. Current state: leads come in, nobody knows which account they belong to.

Goal: custom fields for domain matching, scoring rules, and permission sets — deployed safely through sandbox first.

Use the Architect blueprint for L2A association. Deploy to our dev sandbox, verify, then promote to production.

Bounded AI Output, Not Open-Ended Generation

Architect doesn't just "ask AI to design your org." It discovers your current state, generates bounded specs within enforced safety limits (max fields, max rules), and requires approval tokens before any deployment. Every proposal gets a SHA-256 hash — change the spec and the token invalidates.

How Architect Handles This

1

Discover Schema

Query Lead, Account, and Contact objects. Pull existing custom fields, field counts, and current matching config.

2

Generate Bounded Specs

AI generates custom fields, validation rules, and permission sets — within safety limits (max fields, max rules enforced).

3

Review Proposal

PROPOSAL.md with full spec: fields, rules, permissions. Proposal hash locks the spec for approval.

4

Deploy Sandbox

Approval token required. Metadata pack planned and applied to sandbox org.

5

Verify

Scouts re-run against sandbox to confirm all fields present, permissions assigned, no drift.

6

Deploy Production

Second approval token. Same metadata pack applied to production org with receipt.

After you paste this prompt, Claude Code:

"Need to build L2A matching from scratch. Let me initialize an Architect project and discover the current org state first."

Running
$ g-gremlin autopilot architect init l2a_association_engine --variant salesforce -p target_sandbox=dev -p prod_org_alias=prod
[Architect] Project arch_7f2k created from blueprint: l2a_association_engine (salesforce)
Running
$ g-gremlin autopilot architect discover arch_7f2k
[Architect] Querying Lead, Account, Contact schema... [Architect] Lead: 42 fields (8 custom), Account: 38 fields (5 custom) ✓ Discovery complete: discovery/discovery.json written

"Discovery shows 8 custom Lead fields and 5 custom Account fields. No existing L2A matching config detected. Safe to propose new fields."

Running
$ g-gremlin autopilot architect propose arch_7f2k
[Architect] Generating bounded specs from discovery data... [Architect] Safety limits: max_custom_fields=20, max_validation_rules=10 ✓ Proposal: 4 custom fields, 2 validation rules, 1 permission set ✓ Written: proposal/PROPOSAL.md + proposal/metadata_pack/

Proposal includes bounded specs

Custom fields:
- Lead.L2A_Domain__c (Text 255) — Email domain for matching
- Lead.L2A_Match_Score__c (Number) — Association confidence score
- Lead.L2A_Matched_Account__c (Lookup) — Matched account reference
- Account.L2A_Domain__c (Text 255) — Primary company domain
Validation rules:
- Lead.Require_Company_Email — Block non-business email domains
- Account.Domain_Format_Check — Validate domain format
Permission set:
- L2A_Admin — Full CRUD on L2A fields
Running
$ g-gremlin autopilot architect deploy arch_7f2k --sandbox
[Architect] Approval token required. Posting to Slack #revops-approvals... [Architect] Token received from [email protected] (ttl: 600s) [Architect] Planning metadata pack for sandbox: dev [Architect] Applying metadata pack... ✓ Sandbox deploy complete. Receipt: receipts/arch_7f2k/deploy_sandbox.json
Running
$ g-gremlin autopilot architect verify arch_7f2k
[Architect] Running verification scouts on sandbox... [Architect] ✓ 4 custom fields present [Architect] ✓ 2 validation rules active [Architect] ✓ Permission set assigned ✓ Verification passed: all components confirmed
Running
$ g-gremlin autopilot architect deploy arch_7f2k --prod
[Architect] Second approval token required. Posting to Slack... [Architect] Token received. Deploying to production: prod ✓ Production deploy complete. Receipt: receipts/arch_7f2k/deploy_prod.json

L2A Association Engine deployed. 4 fields, 2 rules, 1 permission set. Sandbox verified. Production receipted.

Output Artifacts

CRM Changes

  • 4 custom fields — Domain, Match Score, Matched Account (Lead + Account)
  • 2 validation rules — Business email required, domain format check
  • 1 permission set — L2A_Admin with full CRUD on matching fields

Local Artifacts

  • PROPOSAL.md — Full spec with rationale and safety analysis
  • metadata_pack/ — SFDX-format fields, rules, and permission set XML
  • deploy receipts — Before/after evidence for sandbox and production

Cross-CRM: Available for both Salesforce (Lead ↔ Account) and HubSpot (contacts ↔ companies). Use --variant hubspot at init.

Results

4
Custom fields
2
Validation rules
1
Permission sets
Pass
Verification

Try This Blueprint

Start a free trial and run the L2A Association Engine on your own org.