Close Won in Salesforce when a Docusign contract is signed

By General Input

When a contract is signed in Docusign, mark the Salesforce opportunity Closed Won, kick off implementation in Linear, and celebrate the win in Slack.

Integrations

  • Docusign
  • Salesforce
  • Linear
  • Slack

Type

Agentic Task

Categories

  • Sales
  • Operations

Build me an agent workflow that turns a signed Docusign contract into a fully closed-won handoff across Salesforce, Linear, and Slack.

Trigger: poll Docusign for envelope_status_changed events, filtered to envelopes that just transitioned to completed (signed by all parties). Ignore sent, declined, voided, and expired transitions.

When a completed envelope comes in, the agent should:

1. Pull the envelope details with Docusign Get Envelope and Get Envelope Form Data. From those, identify the customer / counterparty name, the contract value (total amount), the signed/completed date, and any opportunity reference fields the team puts on the envelope. Also capture the link/URL to the signed envelope so it can be referenced later.

2. Find the matching Salesforce opportunity using a Salesforce SOQL Query. Match on customer/account name plus expected amount and recently-open stage. If there is an opportunity ID embedded in an envelope custom field, prefer that. If no confident match is found, stop and surface a clear message instead of guessing or creating a new opportunity.

3. Update that opportunity with Salesforce Update Opportunity: set StageName to Closed Won, set Amount to the signed contract value, set CloseDate to the envelope completion date, and store the signed contract URL on the opportunity (description or a designated custom field) so anyone in Salesforce can find the executed contract. Capture the AE / Owner from the opportunity so it can be referenced downstream.

4. Open a Linear issue with Linear Create Issue in the implementation/onboarding team to kick off customer onboarding. Title it something like "Onboard <Customer> ($<Deal Size>)". Description should include: customer name, deal size / ACV, AE/owner, contract effective date, a link to the signed Docusign envelope, and a link to the Salesforce opportunity. Set sensible defaults for priority and assignee (e.g. the implementation team lead) so it lands in their queue immediately.

5. Post a celebration message to the Slack #wins channel using Slack Send a Message. Tag the AE (use their Slack handle if available; otherwise their name from Salesforce). Format it cleanly: a 🎉 headline with the customer name and deal size, a short summary of the contract terms (amount, term length if available, start date), and links to the signed contract, the Salesforce opportunity, and the Linear onboarding issue. Keep it scannable, not a wall of text.

Guardrails: this should be idempotent. If the same envelope fires twice, do not re-update Salesforce, do not open a duplicate Linear issue, and do not double-post in Slack. Store the envelope ID on the Salesforce opportunity (or use it to dedupe) and check before each side effect.

Make the Slack channel name (#wins), the Linear team/assignee, and the Salesforce custom field for storing the signed contract URL configurable at the top of the workflow so they're easy to change later.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredChat quality review board for LiveChat support leadsWin back no-show and cancelled appointments every morningLive Loop returns analytics with product-level drill-downNewsletter pre-flight and approval board for Mailjet sendsTurn a prospect spreadsheet into personalized sequence enrollmentsMailjet email delivery lookup console for support teamsCatch feature flags that never got switched on in productionA website visitor queue that remembers what you hide