Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Use Case: Delete Salesforce Opportunity After Contract Cancellation

Business Context

When a contract is canceled, any associated Salesforce Opportunity becomes invalid and should be removed to keep the sales pipeline accurate. Automating this cleanup avoids manual effort, prevents reporting inaccuracies, and ensures the pipeline reflects only active, viable opportunities.

Overview

This use case guides administrators on configuring a Conga Workflow that automatically deletes the Salesforce Opportunity linked to a contract once its status changes to Canceled. The workflow uses a record‑trigger event, an email notification activity, and an HTTP Callout to the Salesforce API. Required inputs include Salesforce API credentials and the Opportunity ID stored on the contract.

Scenario

When a contract's Status is updated to Canceled, the workflow triggers automatically. It first sends an email notification to the assigned sales representative, informing them that the contract has been canceled and the related Opportunity will be removed. Then, using a configured external service, the workflow performs an API call to Salesforce to delete the Opportunity associated with the contract record. This ensures the sales pipeline remains clean without requiring manual intervention.

Prerequisites
  • Salesforce API credentials: Client ID, Client Secret, Access Token, and Endpoint URL.
  • The Opportunity ID is available on the Contract record (e.g., Contract.OpportunityID__c).
  • The Contract Status field includes a clearly defined Canceled status value.
  1. Create the Workflow. To learn how to create a workflow, see Creating Workflows topic. Enter the following sample data:
    Details
    NameDelete_Salesforce_Opportunity_On_Cancellation
    Display NameDelete Salesforce Opportunity
    Description:Deletes the related Salesforce Opportunity when a contract is canceled.
    Workflow Type
    Workflow TypeStandalone Workflow
    TriggerRecord Trigger
    Object NameAgreement
    Trigger Info
    Display NameContract Canceled Trigger
    Reference NamecontractCanceledTrigger
    DescriptionTrigger the workflow when a contract is canceled.
    Action TypeDelete
    Trigger Condition for Update

    Field: Status

    Operator: Equals

    Value: Canceled

    The workflow is created in Draft status with one DataChangeWorkflowTriggerActivity.
  2. Add a Send Email Activity to send an automated email to the assigned sales representative. To learn more, see Send Email topic. Enter the following sample data:
    Details
    Display NameNotify Sales Rep on Cancellation
    Reference NamenotifySalesRep
    DescriptionNotify that the contract has been canceled and the associated opportunity will be deleted.
    Properties
    Recipient TypeUser
    To AddressAssigned Sales Representative's email ID.
    SubjectContract {{Workflow.Context.Record.Name}} Canceled
    BodyClick the three-dot icon in the corner and select Expression as the body type to use the following Liquid expression.
    Hello,
    
    The contract {{Workflow.Context.Record.Name}} has been canceled. As a result, the associated opportunity in Salesforce will be deleted automatically.
    
    Regards,  
    Contract Management System
    
    An EmailActivity is added to the workflow.
  3. Add HTTP Callout Activity. To learn more, see HTTP Callout topic. Enter the following sample data:
    Details
    Display NameDelete Opportunity in Salesforce
    Reference NamedeleteOpportunityAPI
    DescriptionUses Salesforce API to delete the linked Opportunity upon contract cancellation.
    Properties
    External ServicesSelect the whitelisted external authentication service.
    URL

    https://<instance>.salesforce.com/services/data/vXX.X/sobjects/Opportunity/{{Workflow.Variables.OpportunityID}}

    Note:Replace <instance> with your Salesforce instance and vXX.X with the API version number.

    MethodDELETE

    An HttptCalloutActivity is added to the workflow.
  4. After all activities are configured and tested, publish the workflow to make it active.
When a contract is canceled:
  • An email notification is sent to the assigned sales representative.

  • The linked Salesforce Opportunity is automatically deleted using the Opportunity ID.