forecastBilling API is used to generate forecast billing schedules for Smart Cart. A smart cart is a cart with a large number of product line items. This API run in the asynchronous mode. This API accepts the proposal ID or the order ID and the option to extend the end date with renewal term as input parameters. 

APISignature
forecastBillingstatic Id forecastBilling(Id objectId, Boolean extendEndDateWithRenewalTerm)

Forecast Billing Schedules API is used to generate forecast billing schedules, forecast billing summaries, forecast options, and forecast line item options for a large number of product line items. This API can be invoked by the implementation team after the cart is finalized.  

forecastBilling API submits an asynchronous batch job to delete all the existing forecast billing schedules and returns the ID of the submitted batch job as a response parameter. After deleting the existing forecast data, forecastBilling API submits a batch job to generate forecast billing data for all the line items associated with the given proposal ID or the order ID.


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. If you pass a null value, the API considers it as a false value. 

Response

Field

Type

Description

apexJobId

ID

Id of the batch job submitted to delete the forecast billing schedules.
/**
* For a given proposal, delete exising forecast billing data, if any, and regenerate the forecast data.
* This API supports the forecasting for samrt cart.
*
* @param proposalId The proposal Id for which the forecasting needs to be done.
* @param extendEndDateWithRenewalTerm States whether to generate forecasting with current term or extend it with renewal term.
* A 'null' will default to 'false' value
*
* @return The ID of the new batch job (AsyncApexJob).
*
* @note The API functionality involves two batch jobs, one for deleting the existing forecast data,
* and another chained batch is generating the new forecast data.
* Hence, the Id returned by the API is of the first deletion batch job.
*/
global static Id forecastBilling(Id proposalId, Boolean extendEndDateWithRenewalTerm) {
return DeleteForecastedBillingBatchJob.deleteAndRegenerateForecastData(proposalId, extendEndDateWithRenewalTerm);
}
CODE