Daily Salesforce opportunity activity sync from Factors.ai

By General Input

Every weekday at 6am, pull yesterday's account activity from Factors.ai and stamp it as a note on each open Salesforce opportunity's account.

Integrations

  • Salesforce
  • Factors.ai

Type

Deterministic Code

Categories

  • Sales
  • Operations

Build me a daily Salesforce opportunity activity sync workflow.

Trigger: cron, every weekday (Monday through Friday) at 6:00 AM in the user's local timezone.

This is a deterministic pipeline applied to every row, with no judgment calls, so build it as a code workflow.

Step 1 — Pull open opportunities from Salesforce. Use the Salesforce SOQL Query operation to run a query against the Opportunity object that returns Id, Name, OwnerId, AccountId, and Account.Website for every opportunity where IsClosed = false and LastModifiedDate is within the last 45 days. Order by LastModifiedDate descending.

Step 2 — For each opportunity in that result set, derive the bare domain from Account.Website. Strip the protocol, any www. prefix, any path, query string, or trailing slash, and lowercase the result. If Account.Website is empty or cannot be parsed into a domain, skip that opportunity and move on.

Step 3 — Call the Factors.ai Get Account Journey operation using that bare domain, with a from/to window covering the trailing 24 hours (yesterday 00:00:00 through yesterday 23:59:59 in the user's timezone). Handle a 404 from Factors as 'no activity' rather than an error.

Step 4 — If the response contains no events for that account, skip the write entirely and continue to the next opportunity. Do not create empty notes.

Step 5 — If there is activity, format the events into a single short note. Title it something like 'Factors activity — {yesterday's date}'. The body should be a bulleted list, one line per event, in the form '[HH:MM] {event_name} — {user_name or anonymous}'. Cap the list at the 20 most recent events so the note stays readable.

Step 6 — Call the Salesforce Add Note to Account operation, attaching the formatted note to the opportunity's AccountId (not the opportunity itself). Use the OwnerId from the opportunity as the note owner if the operation accepts it.

Continue the loop until every opportunity has been processed. Log a short summary line per opportunity (domain, event count, wrote/skipped) so a human can audit the run.

Use the user's connected Salesforce credential and Factors.ai private token. Treat individual opportunity failures as soft errors — log and continue — rather than failing the whole run.

Related prompts

Explore more prompts
A website visitor queue that remembers what you hidePipeline review board for deals where the buyer went quietABM target account coverage board for demand gen leadsDaily intent triage queue your SDRs work every morningGive every rep a Clay prospecting desk without a Clay seatOne review board for every household in your book of businessMonthly Salesforce contact refresh on open pipeline with ClayPush Databricks churn risk scores into Salesforce every morningDaily Salesloft meeting prep briefs in your inbox at 7amSync new Chargebee subscriptions into Salesforce CRM