Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

By default, Users deploy ClosePlans to Opportunities manually by clicking on the Create button. If there is only one template Template available, it is automatically selected for deployment, otherwise, the User will choose which template Template to deploy.

Sometimes there is a need to deploy ClosePlans automatically based on Opportunity creation or other criteria. ClosePlan provides several ways to achieve this.

...

In order to use automated deployment, the template Template which will be used for deployment must be specified. You can work with specific versions and easily get the version IDs directly from the ClosePlan Admin Template detail, or you can implement logic to retrieve the latest version for a specific Template based on specific Opportunity data.

...

Note

If your organization uses Opportunity Record Types with multiple Sales Processes, and ClosePlan Templates have Staging functionality enabled for Playbooks, remember, that the destination Opportunities must use the same Sales Process as defined in the templateTemplate. Otherwise, deployment will be canceled.

...

Asynchronous Deployment using Batch job

  • Ability to deploy multiple records

  • Async run won’t slow down users

  • It might take few seconds until ClosePlan appears in the UI

  • Can be invoked from Triggers or any Apex class

Code Block
// Provide Template ID
// Note: You can use static template ID or retrieve the latest version for particular Template
Id templateId  = 'a684R000000H7HOQA0';
// Provide set of Opportunity Ids, which should be deployed
Set<Id> oppIds = new Set<Id>{'0060Y00000B8XcX'};

// Create deploy job and execute
TSPC.CPSJob_DealDeploy job = new TSPC.CPSJob_DealDeploy(oppIds, templateId);
Id jobId = DataBase.executeBatch(job, 5); // Max 10 - Tweak depending on template complexity. 

Synchronous Deployment

  • Ability to deploy only to single Opportunity

  • Might slow down users

  • Available immediately after transaction completes

  • Can be invoked from Triggers or any Apex class

...

The following example shows how to create a Salesforce Flow to assign a ClosePlan Template automatically whenever a new Opportunity is created.

  1. Setup > Process Automation > Flows

  2. Click New Flow

  3. Select Record-Triggered Flow

  4. Click Create

  5. For Select Object, select: Opportunity 

  6. For Configure Trigger, select: A record is created

  7. For Set Entry Conditions, define any conditions or none. In this example we will not define any conditions.

  8. For Optimize the Flow for, select: Actions and Related Records

  9. Click Done

...

  1. Image Added
  2. Click the plus sign in the circle to Add Element

    Image Modified
  3. Select Action

    Image Modified
  4. In the New Action modal window under Action, search for and enter: ClosePlan: Deploy Opportunity Template

    Image Modified
  5. In the New Action modal, for Label: enter Deploy ClosePlan Template. The API Name will autofill.

  6. Under Set input Values, find $Record Opportunity and click to enter, then click outside of the box. The value should read: {!$Record} - 

  7. Note: The value may sometimes read: {!$Record.} - the period after ‘Record’ must be deleted.

  8. If there is only one active ClosePlan Template, leave the ‘Don’t Include’ toggle switch off. The Flow will then deploy the only Active Template.

  9. If there is more than one Template Active, and you want a specific Template deployed, go to:
    ClosePlan Admin tab > Templates > Copy the Template ID. 
    You will then activate the toggle switch and paste the Template ID in the field.

    Image Modified
  10. Click Done 

    Image Modified
  11. Click Save 

  12. For Flow Label enter: Deploy ClosePlan Template. The Flow API Name will autofill.

    Image Modified
  13. Click Save 

  14. Click Activate to activate the Flow

...