Forecast Billing Schedules and Summaries API is used to generate and display forecast billing schedules and forecast billing summaries for a Quote/Proposal or an order. This API accepts the proposal ID or the order ID, and the option to extend the end date with renewal term as input parameters and returns the list of forecast billing schedules and forecast billing summaries. 

APISignature
retrieveForecastedBillingSchedulesAndSummariesstatic Apttus_Billing.ForecastedResults retrieveForecastedBillingSchedulesAndSummaries(Id objectId, Boolean extendEndDateWithRenewalTerm)

Forecast Billing Schedules API is used to generate and display forecast billing schedules and forecast billing summaries for a Quote/Proposal or an Order. This API can be invoked by the implementation team on acceptance of the quote/proposal. 

If the forecast billing schedules or forecast billing summaries are already generated for the given proposal and no changes are made to the product configurations, the API displays the existing forecast billing schedules. If you perform any asset-based operations or change the product configuration, the generated forecast billing schedules and billing summaries are deleted and new forecast billing schedules and billing summaries are generated to reflect the changes made to the product or the asset. 

Forecast billing schedule functionality is not supported for:

  • Quote/Proposal associated with a billing plan
  • Informational line items of bundle and option products

Request

Field

Type

Required?

Description

objectID

ID

Yes

The proposal ID or the order ID.

extendEndDateWithRenewalBoolean

Yes

If extendEndDateWithRenewal is set to true, then for each proposal line item with Auto-Renew set to True and the Auto Renewal Type set to Fixed. The end date is extended based on the renewal term.

Response

Field

Type

Description

forecastedSchedules

List

List of forecast billing schedules generated for the given ID.

forecastedSummariesListList of forecast billing summaries generated for the given ID.
/**
 * Class used to support forecasting of Billing Schedules and Invoices.
 */
global with sharing class ForecastedResults {

	global List<ForecastedBillingSchedule__c> forecastedSchedules { get; private set; }
	public List<ForecastedBillingSummary__c> forecastedSummaries { get; private set; }
		
	public ForecastedResults() {
		this.forecastedSchedules = new List<ForecastedBillingSchedule__c>();
		this.forecastedSummaries = new List<ForecastedBillingSummary__c>();
	}
}

/**
 * Create the list of Forecasted Billing Schedules by leveraging the BSM to "forecast" each of
 * the Proposal Line Items belonging to the "active" Product Configuration of the specified Proposal.
 * From the Forecasted Billing Schedules generate the list of Forecasted Billing Summaries.
 *
 * If the Forecasted Billing Schedules/Summaries have already been created and are "current",
 * return the existing forecasted Schedules and Summaries.  Otherwise delete the existing
 * "out of sync" forecasted Schedules and Summaries and use the Product Configuration of the
 * specified Proposal to re-generate (and persist) them. 
 *
 * @param ProposalId The Id of the Proposal (Quote) to use when retrieving (and possibly
 *   generating) the lists of forecasted Billing Schedules and Summaries.
 * @param extendEndDateWithRenewalTerm If the flag is true, then extend the End Date
 *   (based on the Renewal Term) for all Line Items that have Auto Renew set to True and
 *   the Auto Renewal Type set to "Fixed".
 *  
 * @return The list of persisted forecasted Billing Schedules and Billing Summaries.  The forecasted
 *   Billing Schedules will be sorted by "Ready for Invoice Date" and the forecasted Billing Summaries
 *   will be sorted by Invoice Date and Summary Number.
 */
global static ForecastedResults retrieveForecastedBillingSchedulesAndSummaries(
	ID proposalId, Boolean extendEndDateWithRenewalTerm) {

	return new ForecastedResults(); 
}
CODE