An Order Management Plugin is used to set the Order's Start Date. A Quote ID is passed into the plugin and a Date is returned.
An example plugin is one that delays the Order Start Date by a specified number of days using a field on the Quote. The plugin queries for the field value from the Quote, adds that number of days to the current system date, and returns the modified Order Start Date.
The name of the Apex class for the Order Management Plugin is configured via this path:
Setup > Installed Packages > Salesforce CPQ > Configure > Plugins > Order Management Plugin.
The 'Default Order Start Date' value must be set to "-- None --", otherwise the date value overrides the plugin's functionality:
Setup > installed Packages > Salesforce CPQ > Configure > Order > Default Order Start Date
NOTE: The date returned by the plugin will be used for all Orders that are generated in that pass. If you're using the auto-split functionality to split the quote and generate multiple orders, the plugin code doesn't support use cases requiring different start dates on order products.
/**
* Class Name: OrderPlugin
* Description: Order Management Plugin used in Salesforce CPQ to calculate custom Order start date.
* Author: Greg Mlynarczyk
*
* Modification Log:
* Version Date Author Modification
* 1 2017-05-05 Greg Mlynarczyk Created.
*/
global class OrderPlugin implements SBQQ.OrderManagementPlugin{
public Date getOrderStartDate(Id quoteId) {
Date orderStart;
//Query for Quote that matches provided record ID and retrieve the Delayed Start Days field
SBQQ__Quote__c theQuote = [SELECT Id, Delayed_Start_Days__c FROM SBQQ__Quote__c WHERE Id = :quoteId LIMIT 1];
//Add the specified number of days to today's date. If no Delayed Start value is populated, treat as zero.
if(theQuote.Delayed_Start_Days__c == null) {
orderStart = system.today();
system.debug('No Delayed Start populated. Using current system date.');
} else {
orderStart = system.today().addDays(theQuote.Delayed_Start_Days__c.intValue());
system.debug('Found Delayed Start of ' + theQuote.Delayed_Start_Days__c.intValue() + '. Order Start date calculated to be ' + orderStart + '.');
}
return(orderStart);
}
}000384532

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.