Integration · Revenue operations
How to build a lead scoring sync
Marketing scores a lead at 85. Sales sees 40 in the CRM, because the score that synced was last week's. This is the design behind a score both teams read the same way, the prompts that build it, and what production adds.
Built with Tray Headless
- System Marketo
- System Demandbase
- Step Fit and activity
- Step One score
- System Salesforce
Fit and activity are scored separately and only combined at the end, which is what lets anyone explain a score.
The short answer
What is a lead scoring sync?
A lead scoring sync is four parts: fit and activity scored separately so a score can be explained, one combined score written to the CRM by one process only, activity that fades with time so last spring's webinar stops counting, and a threshold that hands the lead to routing the moment it is crossed. The part teams get wrong is ownership. When the marketing platform, the CRM and an intent tool can each write the score field, the number a rep sees is whichever one wrote last, and nobody trusts it.
Stage 6 of 9: Scoring and qualification. Part of Lead routing, end to end : every stage, the systems it runs on and the guide that builds it.
What matters here
- Score fit and activity separately. A lead at 70 could be a perfect account that has done nothing, or a student who downloaded everything, and those need different follow-up.
- Only one process writes the score to the CRM. Every other system sends it signals, never a number.
- Activity should fade. A score that only ever goes up ranks a lead who went quiet a year ago above one who asked for a demo today.
- Crossing the threshold should start routing. The lead should reach a rep within seconds of qualifying.
- Stamp why a lead scored what it did. A rep who can see the reasons acts on the score, and one who can't ignores it.
Who this is for
You run marketing operations or revenue operations. You have a scoring model, probably in the marketing platform, and sales has stopped believing it. You want a score that means the same thing in every system, moves when the buyer moves, and sends qualified leads straight to a rep.
How it works in practice
What happens between a buyer doing something and a rep seeing the score change.
- 1
A signal arrives
A form fill, a pricing page visit, a webinar attended, an intent surge on the account. Each one is recorded as an event with a date before any points are added up.
- 2
Fit is scored from the record
Company size, industry, region and job title, from enrichment. Fit changes when the record changes, not when the buyer clicks.
- 3
Activity is scored from recent events
Each event carries points that fade over time. A demo request this week counts in full; the same request six months ago counts for little.
- 4
One combined score is written to the CRM
With the fit score, the activity score and the top three reasons beside it, so a rep sees why as well as how much.
- 5
Crossing the threshold sends the lead to routing
The status changes to marketing qualified and the routing workflow runs at once. No overnight batch, no list for someone to export.
- 6
Dropping back below it is recorded too
A lead that went quiet returns to nurture with a reason, rather than sitting in a rep's queue for a quarter.
What a lead scoring sync is made of
A score is only as useful as the agreement about what it means. These four parts are what make that agreement hold across systems.
Two scores, combined last
Fit (who they are) and activity (what they did) are kept as separate numbers. The combined score is a simple rule on top, such as a grid of fit band against activity band, that anyone can read.
One writer
The scoring workflow is the only thing allowed to write the score fields in the CRM. The marketing platform, intent tools and product data send it signals.
Activity that fades
Each type of activity has a half-life. Recent activity counts most, and a lead that goes quiet drifts back down without anyone resetting it.
A threshold that acts
Qualifying changes the lead status and starts routing in the same run. Falling back out of qualification is just as visible.
The Tray Headless prompts
Paste these into Claude Code or Codex with the Tray Headless plugin installed. Each stage runs on its own. The systems named in them are the worked example rather than a requirement, and every prompt says so.
Once per project, run
/tray-workflows:set-workspace
to pick the workspace these build in. Point it at a sandbox first.
- 1
Set up, and see what is actually connected
Before anything is built, confirm the ground truth.
Headless skills
build-workflowUse build-workflow. The systems in play are Marketo, Salesforce, Demandbase, Snowflake and Slack, or whatever we run in those seats. Before you plan anything, tell me which are already authenticated in the workspace. I expect Marketo, Salesforce and Slack. Then list every field in Salesforce and Marketo that currently holds a score, and which process writes to each one. I want to see the overlap before we change it.
The list of current writers is usually the finding. Three processes writing one field is why the number moves for no reason.
- 2
Record signals as dated events
Activity has to be stored with its date before it can fade.
Headless skills
build-workflowUse build-workflow. Trigger on Marketo activity for: form fill, web page visit on /pricing or /demo, email click, webinar attended. Also take a daily Demandbase intent export for accounts in Salesforce. For each one, write a row to a Snowflake table with lead id, activity type, points and the date it happened. Do not add points to a running total anywhere. Points per type come from a table I can edit: demo request 40, pricing page 15, webinar attended 20, email click 3, intent surge on the account 10 Webinar registration with no attendance scores zero.
- 3
Score fit and activity, then combine them
The step that makes the score explainable.
Headless skills
build-workflowFit score, out of 100, from the Salesforce lead: employee count band, industry on our target list, country in a sold region, and title seniority. Recalculate when any of those fields change. Activity score, out of 100: sum of event points where each event halves in value every 30 days. Recalculate nightly and on every new event. Combined score: fit band A to D against activity band 1 to 4, from a grid I can edit. Write Fit_Score__c, Activity_Score__c, Lead_Grade__c and Score_Reasons__c (the top three events or fit factors) to the Salesforce lead. This workflow is the only writer of those fields.
- 4
Turn qualification into routing
A score only pays off when something happens the moment it changes.
Headless skills
build-workflowtray-patternsWhen a lead moves into grade A1, A2 or B1, set Status to Marketing Qualified, stamp MQL_Date__c, and call the lead routing workflow straight away with the lead id. When a qualified lead falls below B2 with no open task, set Status back to Nurture, stamp the reason, and tell the owner in Slack. If the same lead qualifies twice in one day, route it once.
- 5
Handle the four things that break it
Each one has made a sales team stop reading the score.
Headless skills
tray-gotchasUse tray-gotchas, then handle these explicitly: The marketing platform still writes its own score. Stop its sync to the Salesforce score field, and keep its number as a signal only. Enrichment arrives after the lead. Re-run the fit score when the enrichment fields fill in, not only at creation. Existing customers score as new leads. If the lead matches an account with a closed won opportunity, send it to the account owner instead of the new business queue. Bulk imports flood the threshold. Leads created by a list import score fit only until they show activity of their own.
- 6
Check the model against what closed
The step that keeps the score honest a year from now.
Monthly, from Snowflake: for leads that qualified 90 or more days ago, show the rate that became opportunities and the rate that became closed won, by grade. Flag any grade where a lower grade converts better than a higher one. Then open the workflow in Tray Build so marketing operations can change the points table and the grid without a coding assistant.
If grade B converts better than grade A for two months running, the model is wrong, and this report is how you find out before sales does.
What it connects to
Scoring reads signals from everywhere a buyer shows interest and writes one answer to the place reps work.
Marketo
Send form fills, page visits, email clicks and webinar attendance as dated activity, with the campaign that drove it.
Reads
HubSpot
The same activity signals where HubSpot is the marketing platform, read through its activity history.
Reads
Salesforce
Read the lead and account record for fit. Write the fit score, activity score, grade, reasons and status.
Reads and writes
Demandbase
Add account-level intent, so a surge across the buying team lifts every lead on that account.
Reads
Snowflake
Keep every dated event and every score change, which is what fading and the monthly model check are calculated from.
Reads and writes
Same build, other stacks
The design does not change if you run something else in one of these seats. The same prompts build it against Microsoft Dynamics 365, Google BigQuery, Microsoft Teams, Braze, Databricks or Google Chat.
Connections in this build
Field mapping, templates and common problems for each pairing: Marketo + Salesforce, HubSpot + Salesforce, Demandbase + Marketo and Demandbase + HubSpot.
Named systems are the ones most teams run, not the only ones that work. Each is an authentication in your Tray workspace, referenced by name, so the workflow never holds a credential. Where we have a connector page, the name links to it.
Running it in production
The build gets you a working score. Sales will only use it if it stays right as the model changes.
It runs on the platform
Scoring fires on every buyer action, at whatever volume marketing generates. It runs on the same engine as everything else, with retries and a record of each change.
Only one workflow can write the score
Access control on the platform decides which workflow can write the score fields, so a new integration cannot quietly start overwriting them.
Credentials are held by the platform
The marketing platform, the CRM and the intent provider are each an authentication in your workspace, never a key pasted into code.
Marketing operations owns the model
The points table and the grade grid open in Tray Build, so a change to the model is an edit by the person who owns it, with the change logged.
Drift shows up before sales complains
Alert when the share of new leads qualifying jumps or drops sharply in a day, which usually means a signal broke rather than demand changed.
Questions people ask
Why separate fit and activity?
Because the same total can mean opposite things. A lead with high fit and no activity needs nurture, and one with high activity and poor fit may not be a buyer at all. Keeping them apart tells a rep which one they are looking at.
Why should activity fade?
A score that only rises ranks old interest above new interest. Fading each activity over time means the score reflects what the buyer is doing now.
Can we keep the score in Marketo or HubSpot?
You can keep calculating there and send the result as one signal. What matters is that only one process writes the score the CRM shows, so sales and marketing read the same number.
What happens when a lead qualifies?
Its status changes and the routing workflow runs in the same moment, so the lead reaches a rep in seconds rather than waiting for a nightly list.
Can marketing operations change the model without engineering?
Yes. The points table and the grade grid open in Tray Build, so a change is a visual edit by the person who owns the model.
Further reading
Background on the same subject, for the case rather than the build.
Related guides
Revenue operations
How to build lead enrichment that does not stall the queue
Enrich on a budget and a timeout, cache by domain, fall back between providers, and never hold a lead waiting for a field. The Headless prompts that build it.
Revenue operations
How to build lead routing that assigns in seconds
Match the lead to an account first, evaluate rules in a fixed order, catch what they miss, and time it from arrival. The Headless prompts that build it.
Revenue operations
How to build speed-to-lead alerts
Alert the rep with everything they need, start a clock on every lead, escalate before it goes cold, and reassign when nobody picks it up. The Headless prompts that build it.
Revenue operations
How to build a CRM to marketing automation sync
Decide field ownership before you build, sync deltas not everything, handle the person-versus-lead model gap, and break loops. The prompts that build it.
Last reviewed October 2026.