Versions Compared

Key

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

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

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

...

In order to use automated deployment, the Template which will be used for deployment must be specified. You can work with specific versions and easily get the Choose the specific version and 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 Template. Otherwise, the deployment will be canceled.

...

In order to use automated deployment, you will need to specify to which Opportunities ClosePlan should be deployed.

This is usually achieved using with Opportunity Triggers, using records that are being currently updated in conjunction with any additional logic.

...

Info

If you try to Deploy a ClosePlan to Opportunity that already has a ClosePlan, the deployment will be canceled. You can always determine if a ClosePlan exists by checking TSPC__CPDealHasDeal__c field on the Opportunity. This field will be null if no ClosePlan exists.

...

There are two ways to deploy for APEX, synchronous and asynchronous.

Synchronous

The synchronous approach supports a single Opportunity record deployment at a time only, and it is an ideal . Use this approach if you expect that the user should see ClosePlan in place immediately after the transaction completes.

Asynchronous

For multiple Opportunity deployment, you should use an asynchronous approach or switch between both synchronous and asynchronous based on data-set size. The asynchronous approach will not slow down the running users.

The logic of related to when the deployment should occur is solely up to you, but usually it is triggered after Opportunity creation, Stage change, or any other plausible criteria.

Info

Deploying through APEX is the most efficient method and allows you to handle for complex logic and decisions.

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

...