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.

download

Use Case: External API Invocation

Delete Opportunity in Salesforce After Contract Cancellation.

Salesforce API credentials:

  • Client ID

  • Client Secret

  • Access Token

  • Endpoint URL

The Opportunity ID must be available on the Contract record (e.g., Contract.OpportunityID__c).

The Contract Status field must include a clearly defined Canceled status value.

When a contract is canceled, the related sales opportunity is no longer valid and should be removed from the Salesforce system to avoid pipeline clutter. In this scenario, a workflow is triggered when the contract status changes to Canceled. As part of the workflow, a notification is sent to the assigned sales representative informing them of the cancellation. Then, the External API Invocation Activity is used to call Salesforce's REST API using the DELETE method to remove the associated opportunity based on the stored Opportunity ID.
  1. Create the Workflow. To learn more about workflow creation, see the 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

    A workflow is created in draft status with one DataChangeWorkflowTriggerActivity.
  2. Add a Send Email Activity. To learn more about this activity, see the 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 enter a 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 about this activity, see the 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> and vXX.X appropriately.

    MethodDELETE

    An HttptCalloutActivity is added to the workflow.
  4. Once all activities are configured and tested, Publish the workflow to make it active.
When a contract is cancelled:

The workflow sends an email notification to the assigned sales representative.

The linked opportunity in Salesforce is deleted automatically using the Opportunity ID.